home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 011a / tlx321_4.zip / SALT.DOC < prev    next >
Text File  |  1993-02-05  |  216KB  |  6,832 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.      T E L I X
  27.  
  28.      ─────────────────────────────────────────────────────────────────
  29.  
  30.      SALT Programming Manual
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.                Copyright (C) 1986-1993 by deltaComm Development
  44.  
  45.  
  46.                               ALL RIGHTS RESERVED.
  47.  
  48.  
  49.  
  50.                              deltacomm Development
  51.  
  52.                     P.O. Box 1185, Cary, NC   27512   USA
  53.  
  54.              (919)-460-4556 / (919)-460-4531 fax (919)-481-9399 BBS
  55.      Telix v3.21 - SALT Programming                         COPYRIGHT    ii
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                 COPYRIGHT NOTICE
  64.  
  65.  
  66.  
  67.      Telix is Copyright (c) 1986-1993 by deltaComm Development.
  68.  
  69.      This document is Copyright (c) 1988-1993 by deltaComm Development.
  70.  
  71.      No parts of Telix or this document may be copied in part or in whole,
  72.      except as provided in the License included with Telix.
  73.  
  74.  
  75.  
  76.  
  77.  
  78.                                    DISCLAIMER
  79.  
  80.      deltaComm Development makes no warranty of any kind, either express
  81.      or implied, including but not limited to implied warranties of
  82.      merchantability and fitness for a particular purpose, with respect
  83.      to this software and accompanying documentation.
  84.  
  85.      IN NO EVENT SHALL DELTACOMM DEVELOPMENT BE LIABLE FOR ANY DAMAGES
  86.      (INCLUDING DAM- AGES FOR LOSS OF BUSINESS PROFITS, BUSINESS
  87.      INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY
  88.      LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS PROGRAM,
  89.      EVEN IF DELTACOMM DEVELOPMENT HAS BEEN AD- VISED OF THE POSSIBILITY
  90.      OF SUCH DAMAGES.
  91.  
  92.  
  93.      
  94.                                    TRADEMARKS
  95.  
  96.      Telix and SALT are trademarks of deltaComm Development.
  97.      Telix v3.21 - SALT Programming                         Contents    iii
  98.  
  99.  
  100.  
  101.      
  102.  
  103.                                  C O N T E N T S
  104.  
  105.  
  106.  
  107.      1.  The Telix SALT Language.....................................1
  108.      1.1  What Can be Accomplished With SALT?........................1
  109.      1.2  About This Manual..........................................1
  110.      1.3  Notation...................................................1
  111.      1.4  Creating SALT Programs.....................................1
  112.  
  113.      2.  Syntax......................................................3
  114.      2.1  Comments...................................................4
  115.  
  116.      3.  Program Structure...........................................5
  117.      3.1  Variables..................................................5
  118.      3.2  Expressions and Operators..................................7
  119.      3.3  Functions..................................................9
  120.      3.4  Statements................................................10
  121.        3.4.1  The Expression statement..............................11
  122.        3.4.2  The If statement......................................11
  123.        3.4.3  The While statement...................................13
  124.        3.4.4  The Do...While statement..............................13
  125.        3.4.5  The For statement.....................................14
  126.        3.4.6  The Return statement..................................15
  127.        3.4.7  The Break statement...................................15
  128.        3.4.8  The Continue statement................................16
  129.        3.4.9  The Goto statement....................................17
  130.  
  131.      4.  Built-in Functions.........................................19
  132.      4.1  Quick Listing of Functions by Type........................20
  133.      4.2  Complete Function Reference...............................22
  134.  
  135.      5.  System Variables...........................................97
  136.  
  137.      6.  Appendix A - ASCII Character Set..........................114
  138.      7.  Appendix B - Extended Key Scan Codes......................115
  139.      8.  Appendix C - Color Values.................................116
  140.      9.  Index.....................................................117
  141.  
  142.      Telix v3.21 - SALT Programming                       Introduction    1
  143.  
  144.  
  145.  
  146.  
  147.  
  148.      1.  THE TELIX SALT LANGUAGE
  149.  
  150.      Telix has a built-in programming language called SALT (Script Applica-
  151.      tion Language for Telix). SALT will allow you to perform almost any
  152.      communications related applications with Telix. SALT looks similar to
  153.      the C language, however if you have used almost any programming lan-
  154.      guage (such as Pascal, BASIC, etc.), you should feel quite at home
  155.      with SALT. While SALT was designed to be easy to learn, it is like
  156.      most programming languages quite complete, so it is recommended that
  157.      you read this chapter thoroughly and study the examples provided, as
  158.      well as the sample SALT scripts included with Telix.
  159.  
  160.  
  161.      1.1  What Can be Accomplished With SALT?
  162.      ──────────────────────────────────────────────────────────────────────
  163.  
  164.      Like a program in any programming language, a SALT program (also
  165.      called a 'script') is typically used to perform a needed task or func-
  166.      tion. The task can range from the very simple to the very complicated.
  167.      For example, a SALT script can be linked to a dialing directory entry,
  168.      so that when you have established a connection to that service, it au-
  169.      tomatically sends your i.d. and password to the remote service. A much
  170.      more complicated SALT script is used as the basis for the Host Mode
  171.      included with Telix.
  172.  
  173.  
  174.      1.2  About This Manual
  175.      ──────────────────────────────────────────────────────────────────────
  176.  
  177.      This manual is basically a reference to the SALT programming language.
  178.      It is by no means a tutorial on programming in general. It is assumed
  179.      that the reader of this manual is at least familiar with general pro-
  180.      gramming concepts.
  181.  
  182.  
  183.      1.3  Notation
  184.      ──────────────────────────────────────────────────────────────────────
  185.  
  186.      Throughout this manual, certain words in examples and in the text will
  187.      be surrounded by angle brackets and italicized, for example,
  188.      <expression>. These words are not to be taken as literal text. they
  189.      stand for something else, such as a word, a group of words, or even
  190.      several lines of text. What these italicized words stand for will be
  191.      explained as they come up.
  192.  
  193.  
  194.      1.4  Creating SALT Programs
  195.      ──────────────────────────────────────────────────────────────────────
  196.  
  197.      A SALT script is basically a sequence of instructions for Telix to
  198.      follow, using a specific syntax. You may use any text editor to pro-
  199.      duce this script file, as long as its output is normal ASCII text
  200.      (this means that if you use your word processor, you must usually ex-
  201.      plicitly tell it to write out the file using ASCII format and to not
  202.      embed any special codes in the file). You may give any name you wish
  203.      Telix v3.21 - SALT Programming                       Introduction    2
  204.  
  205.  
  206.  
  207.      to a SALT source file, although we recommend that you always use the
  208.      extension .SLT for clarity.
  209.  
  210.      Once you have written your script file and saved it to disk, it must
  211.      be compiled. The program CS.EXE included with Telix reads your
  212.      'source' script file, and compiles it to a form which Telix can under-
  213.      stand. The compiled script can then be loaded more quickly by Telix,
  214.      and is also usually smaller.
  215.  
  216.      To compile a script source file, type
  217.  
  218.           cs <pathname>
  219.  
  220.      while at the DOS prompt and then press Enter (or Carriage Return). The
  221.      CS.EXE program must be in the current directory or on the DOS PATH.
  222.      <pathname> is the name of the file to compile, and may include the
  223.      drive and directory as well as the filename. The output file is writ-
  224.      ten to the same name except that the extension .SLC is used.
  225.  
  226.      When the script compiler finds an error in your source file, it will
  227.      abort the compile process and give you the line number on which the
  228.      error occurred, as well as the type of error. The error should then be
  229.      fixed and the source re-compiled. This is repeated until the compiler
  230.      detects no more errors in your source file.
  231.  
  232.      The compiled script can then be run in Telix using several methods. It
  233.      may be run using the 'Run script' command, as a command-line option
  234.      when running Telix from DOS, as a linked script to a dialing directory
  235.      entry, or from another script. The first three methods are described
  236.      in the Telix manual, while the last is described later in this manual.
  237.      Telix v3.21 - SALT Programming                             Syntax    3
  238.  
  239.  
  240.  
  241.  
  242.  
  243.      2.  SYNTAX
  244.  
  245.      Case is not important in command, function, and variable names. The
  246.      only time case matters is inside a string constant (e.g., "Hello" is
  247.      not the same string as "hello"). Whitespace (such as the space, the
  248.      tab, the Carriage Return, or the Line Feed character) is not impor-
  249.      tant. The script compiler does not care where you place items, so that
  250.      you may arrange the program as you see fit. For example,
  251.  
  252.           if (value == 1)
  253.             prints("value is equal to 1!");
  254.           else
  255.             prints("values is not equal to 1.");
  256.  
  257.      is equivalent to
  258.  
  259.           if (value == 1) prints("value is equal to 1!");
  260.           else            prints("value is not equal to 1");
  261.  
  262.      or even to
  263.  
  264.           if(value==1)prints("value is equal to 1!");else prints("value is
  265.           not equal to 1.");
  266.  
  267.      The only time whitespace matters is when it would split up key-words
  268.      or function name, or in a string. For example, the key-word 'while'
  269.      must not be split up if it is to be recognized. The same applies to
  270.      other key-words or function names. As well, there must be space be-
  271.      tween the letters of a command and other letters. For example, 'while'
  272.      is not the same as 'whileabc'. In the interest of clarity, it is rec-
  273.      ommended that you try to make your code easy to understand, by indent-
  274.      ing where appropriate, and by using space effectively. There is no
  275.      reason, for example, to put more than one statement on a line, even if
  276.      it is perfectly legal. A good example of program style can be found by
  277.      looking at the sample scripts included with Telix.
  278.  
  279.      A string constant is a sequence of ASCII characters enclosed in
  280.      quotes, for example, "Hello", "Good-bye", or "Telix". It is often nec-
  281.      essary for a string constant to include special characters that can
  282.      not easily be typed from the keyboard, or can not be easily displayed.
  283.      This is done with something called the escape character, which is the
  284.      caret ('^') symbol. When the SALT compiler is reading a string con-
  285.      stant and comes to the '^' symbol, it replaces it with a certain ASCII
  286.      code based on the character following the ^. Translations are as fol-
  287.      lows:
  288.  
  289.           ^c        'c' is a letter. The Control representation of whatever
  290.                     letter 'c' is, is inserted into the text. Therefore ^M
  291.                     represents Ctrl-M, ^j represents Ctrl-J, etc. Whether
  292.                     the letter 'c' is upper or lower case is not signifi-
  293.                     cant. Note that what is really happening here is that
  294.                     64 is being subtracted from the value of 'c', so for
  295.                     example, the Escape character can be represented as ^[.
  296.           ^^        An actual caret ('^') symbol is placed into the text.
  297.      Telix v3.21 - SALT Programming                             Syntax    4
  298.  
  299.  
  300.  
  301.           ^"        An actual double quote symbol ('"') is placed into the
  302.                     text. If a string must contain a double quote symbol,
  303.                     this is how it has to be done. If the plain '"' symbol
  304.                     were to be used, the compiler would think that the
  305.                     string was terminated at that point. For example, the
  306.                     string "He said, ^"Hello^"." is translated to 'He said,
  307.                     "Hello".'.
  308.           ^'        An actual single quote symbol (''') is placed into the
  309.                     text.
  310.           ^nnn      'nnn' is up to 3 digits representing the ASCII value of
  311.                     the character which should be placed into the text. A
  312.                     maximum of three digits is read, or up to the first
  313.                     non-digit character. For example, the compiler would
  314.                     read in the string "S^65LT" and output the string
  315.                     "SALT", since 65 is the ASCII value of 'A'. Note that
  316.                     if nnn is less than 3 digits you may have to pad it
  317.                     with one or two leading zeros if there are digits imme-
  318.                     diately following it in the string, so that the wrong
  319.                     value is not read in. For example the string "^79 Park
  320.                     Avenue" would translate to "O Park Avenue" since 79 is
  321.                     the ASCII value of 'O'. If you actually wanted Ctrl-G
  322.                     (ASCII code 7) followed by "9 Park Avenue", you would
  323.                     use the string "^0079 Park Avenue".
  324.  
  325.      An integer constant is a sequence of digits representing an integer
  326.      value in the range -2147483648 to 2147483647. An integer constant must
  327.      start with a digit from 0 to 9 or the negative sign (-) followed by a
  328.      digit. The following are all valid integer constants:
  329.  
  330.           10
  331.           -400067
  332.           999
  333.  
  334.      An integer constant may also be entered in hexadecimal form (base 16,
  335.      where each digit may be from '0' to '9' or 'a' to 'f', to represent 16
  336.      values). Hex values must be preceded by '0x' for the compiler to in-
  337.      terpret them as such, and case is not important. The following are all
  338.      valid integer constants enter in hexadecimal form:
  339.  
  340.           0xff00
  341.           0Xa2
  342.           0x7D
  343.           0x1AbCdEf
  344.  
  345.  
  346.      2.1  Comments
  347.      ──────────────────────────────────────────────────────────────────────
  348.  
  349.      A comment in a source file is text that does not affect what the pro-
  350.      gram does, and is meant purely for explaining or describing something.
  351.      In a SALT source file, whenever the symbol // is encountered on a
  352.      line, all the characters from that point on until the end of the line
  353.      are considered to be a comment and are ignored. For example:
  354.  
  355.           prints("Hello");       // This line will print "Hello"
  356.      Telix v3.21 - SALT Programming                  Program Structure    5
  357.  
  358.  
  359.  
  360.  
  361.  
  362.      3.  PROGRAM STRUCTURE
  363.  
  364.      A SALT script has the following format:
  365.  
  366.           <global_variable_definition>
  367.                ...
  368.           <global_variable_definition>
  369.  
  370.           <function_definition>
  371.  
  372.           <global_variable_definition>
  373.                ...
  374.           <global_variable_definition>
  375.  
  376.           <Function_definitions>
  377.  
  378.                ...
  379.  
  380.      and so on. Basically a script file consists of definition of global
  381.      variables (variables which are available to any part of the script
  382.      file after which they are defined, and function definitions (functions
  383.      are lines of code clustered together in a group, so that they can be
  384.      called by a name). A script file does not have to have any global
  385.      variables or functions, but to run it must at least have one function
  386.      called 'main'. The following, for example, is a complete script file:
  387.  
  388.           main()
  389.  
  390.           {
  391.  
  392.            prints ("hello");
  393.  
  394.           }
  395.  
  396.      When compiled and run, this script would print the string "hello" to
  397.      the screen.
  398.  
  399.  
  400.      3.1  Variables
  401.      ──────────────────────────────────────────────────────────────────────
  402.  
  403.      A variable is a location in memory where something is stored. The con-
  404.      tents of a variable can be changed by program code (hence the name).
  405.      In SALT, there are two types of variables, integer variables, and
  406.      string variables. The former holds an integer value (e.g., 485624, or
  407.      -627), while the latter holds a text string (e.g. "Telix", or
  408.      "SCRIPT"). Depending on where it is defined, a variable is either
  409.      global or local. If a variable is global, it means that it can be used
  410.      by any part of the script after the point where it is defined. If a
  411.      variable is local, it means that it can only be used by the part of
  412.      the script to which it is 'local', for example, the function inside
  413.      which it is defined. A variable name can be up to 31 digits long, and
  414.      may include the letters 'A' to 'Z' or 'a' to 'z', the digits '0' to
  415.      '9', or the underscore character (_). The name may not start with a
  416.      Telix v3.21 - SALT Programming                  Program Structure    6
  417.  
  418.  
  419.  
  420.      digit. For example, 'his_name2' and '_his_name2' are legal as variable
  421.      names, while '2his_name' is not.
  422.  
  423.      An integer variable is defined in the form
  424.  
  425.           int <varname>;
  426.  
  427.      where <varname> is the name to be given to the variable. An alternate
  428.      definition is
  429.  
  430.           int <varname1>, <varname2>, ..., <varnameN>;
  431.  
  432.      which allows you to define more than one integer variable in one
  433.      statement. An original value can be assigned to the integer variable
  434.      by using the form
  435.  
  436.           int <varname> = <int_const>;
  437.  
  438.      where <int_const> is an integer constant. Similarly, an original value
  439.      can be assigned in the multiple definition above by placing the as-
  440.      signment before the comma. Some examples are:
  441.  
  442.           int maximum;
  443.           int start = 0;
  444.           int level, i, count = 20, loop;
  445.  
  446.      A string variable is defined in the form
  447.  
  448.           str <varname>[<max>];
  449.  
  450.      where <varname> is the name to be given to the variable. <max> is the
  451.      maximum number of characters that the string can hold, and must be in
  452.      the range of 0 to 32767. An alternate definition is
  453.  
  454.           str <varname>[<max>], <varname2>[<max>], ..., <varnameN>[<max>];
  455.  
  456.      which allows you to define more than one string variable in a state-
  457.      ment. An original value can be assigned to the string variable by us-
  458.      ing the form
  459.  
  460.           str <varname>[<max>] = <str_const>;
  461.  
  462.      where <str_const> is a string constant. Similarly, an original value
  463.      can be assigned in the multiple definition above by placing the as-
  464.      signment before the comma. Some examples are:
  465.  
  466.           str password[80];
  467.           str password[40] = "mypass", name[30];
  468.  
  469.      The string length field may be left empty if an original value is
  470.      specified, in which case the length of the string variable is assumed
  471.      to be that of the assigned text, e.g.
  472.  
  473.           str name[] = "John";
  474.  
  475.      If a variable is outside of a function, it is global. If it is defined
  476.      inside a function, it is local to that function and will only be rec-
  477.      Telix v3.21 - SALT Programming                  Program Structure    7
  478.  
  479.  
  480.  
  481.      ognized there. If a variable defined inside a function uses the same
  482.      name as a global variable, any reference to that name while in the
  483.      function will access the local variable. After the function has com-
  484.      pleted, the local variable is removed and a reference to that name
  485.      will access the global variable.
  486.  
  487.  
  488.      3.2  Expressions and Operators
  489.      ──────────────────────────────────────────────────────────────────────
  490.  
  491.      An expression is a mixture of symbols which resolves to a value when
  492.      evaluated. In other words, an expression is basically a formula. An
  493.      expression can consist of constants, variables, function calls, and
  494.      operators. An expression can be very simple, or very complicated. For
  495.      example, some expressions are:
  496.  
  497.           10 + 3 - 5
  498.           9 * 7 / 63 - 30
  499.           result = 10 * max(a, b)
  500.           month >= 10
  501.           200
  502.           command == "bye"
  503.           prints("Hello")
  504.  
  505.      In an expression, the data being acted upon are constants, variables,
  506.      and functions calls, while the operators (+, *, etc.) are the symbols
  507.      that do things with the data. There are many different operators, of
  508.      which there are two basic types. Binary operators (such as +, *, /)
  509.      perform a calculation on the expression on either side of them. Unary
  510.      operators appear before a single expression and work on that. The fol-
  511.      lowing table lists the operators available in SALT:
  512.  
  513.             Symbol      (Un/Bin)ary          What it is/does
  514.               -            unary             Arithmetic negation
  515.               !            unary             Logical NOT
  516.              not           unary             Logical NOT (alternate)
  517.               ++           unary             Increment
  518.               --           unary             Decrement
  519.               *            binary            Multiplication
  520.               /            binary            Division
  521.               %            binary            Remainder (Mod)
  522.               +            binary            Addition
  523.               -            binary            Subtraction
  524.               <            binary            Less than
  525.               >            binary            Grater than
  526.               <=           binary            Less than or equal to
  527.               >=           binary            Greater than or equal to
  528.               ==           binary            Equality
  529.               !=           binary            Inequality
  530.               &            binary            Bitwise AND
  531.               |            binary            Bitwise OR
  532.               ^            binary            Bitwise Exclusive OR
  533.               &&           binary            Logical AND
  534.              and           binary            Logical AND (alternate)
  535.               ||           binary            Logical OR
  536.               or           binary            Logical OR (alternate)
  537.               =            binary            Assignment
  538.      Telix v3.21 - SALT Programming                  Program Structure    8
  539.  
  540.  
  541.  
  542.  
  543.      Note that the hyphen symbol can be either an arithmetic negation or a
  544.      subtraction depending on its use. Note that '!' is equivalent to
  545.      'not', '&&' is equivalent to 'and', and '||' is equivalent to 'or'.
  546.      The first form is preferred as you do not have to leave whitespace
  547.      around it for the compiler to recognize it, but beginners may have an
  548.      easier time remembering the second form. Also, do not confuse the '='
  549.      (assignment operator) with the '==' (equality operator). The former is
  550.      used to assign a value to a variable, while the latter is used to com-
  551.      pare two values. Assuming you have the two expressions, <expr1> and
  552.      <expr2>, <expr1> = <expr2> would assign one to the other, while
  553.      <expr1> == <expr2> would test the two to see if they are equal. For
  554.      example
  555.  
  556.           num = 10
  557.  
  558.      would assign the value 10 to the variable called 'num', while
  559.  
  560.           num == 10
  561.  
  562.      would resolve to a value of non-zero (TRUE) if num was equal to 10,
  563.      and 0 (FALSE) if num was not equal to 10. There is also a difference
  564.      between the Logical operators and the Bitwise operators. The Logical
  565.      operators (such as and, &&, or, ||, etc), work with TRUE or FALSE val-
  566.      ues and result in a TRUE or FALSE value, while the Bitwise operators
  567.      (&, |, ^) work with the actual bits of the data they are handling. The
  568.      Bitwise operators almost never have to be used in a Telix script, un-
  569.      less it is needed to get at the actual bits in a data byte.
  570.  
  571.      Every operator resolves to a value, which is the result of the opera-
  572.      tion performed (e.g, 10 * 7 would resolve to 70). The conditional or
  573.      equality operators such as ==, >, <=, etc., resolve to  a 0 (FALSE))
  574.      or non-zero (TRUE) value based on the results of the expression. Even
  575.      the assignment operator = resolves to a value. The result of the ex-
  576.      pression
  577.  
  578.           num = 10
  579.  
  580.      would be 10.
  581.  
  582.      All the operators have something called precedence, which is their im-
  583.      portance, and determines the order in which they are evaluated. For
  584.      example, 7 + 3 * 9 is equal to 34, because 3 * 9 is evaluated first,
  585.      and then added to 7 (* has a higher precedence than +). All the opera-
  586.      tors are listed below in order of decreasing precedence. All the oper-
  587.      ators on the same line have the same precedence, and are resolved in
  588.      the order that they are encountered.
  589.      Telix v3.21 - SALT Programming                  Program Structure    9
  590.  
  591.  
  592.  
  593.           -  !
  594.           ++  --
  595.           *  /  %
  596.           +  -
  597.           <  >  <=  >=
  598.           ==  !=
  599.           &
  600.           |
  601.           and  &&
  602.           or  ||
  603.           =
  604.  
  605.      If a certain evaluation order is required that does not follow these
  606.      rules of precedence, parentheses may be used. Thus, 99 + 1 * 10 equals
  607.      109, while (99 + 1) * 10 equals 1000.
  608.  
  609.      If you are writing an expression of any sort, and are not sure of the
  610.      exact precedence of the operators you are using, use parentheses!
  611.  
  612.  
  613.      3.3  Functions
  614.      ──────────────────────────────────────────────────────────────────────
  615.  
  616.      A function is a way of grouping together some lines of code. A Telix
  617.      script consists of one or more functions. There are quite a few advan-
  618.      tages to having functions:
  619.  
  620.           One function can be called from another, to do a certain task.
  621.           The calling function does not have to know anything about the
  622.           called function other than what it does. This allows a script to
  623.           be split up into modular units, and makes code writing and debug-
  624.           ging easier.
  625.  
  626.           As mentioned above, what a function does it private. This means
  627.           that data variables defined in a function are local to that func-
  628.           tion, and therefore you do not have to worry about another part
  629.           of the script unintentionally modifying them.
  630.  
  631.           A library of functions can thus be built. Later, you do not have
  632.           to re-write old code.
  633.  
  634.      Functions are defined in the following format:
  635.  
  636.           <funcname>(<arg1>, <arg2>, ..., <argN>)
  637.  
  638.           {
  639.            <variable_def>
  640.                ...
  641.            <variable_def>
  642.  
  643.            <statement>
  644.                ...
  645.            <statement>
  646.           }
  647.      Telix v3.21 - SALT Programming                 Program Structure    10
  648.  
  649.  
  650.  
  651.      <funcname> is the name of the function. It follows the same rules of
  652.      other identifiers in SALT. There can only be one function that uses a
  653.      given name, however.
  654.  
  655.      <arg1> through <argN> are the declarations of the arguments
  656.      (parameters) that have been passed to the function by its caller
  657.      (sometimes, to accomplish its task, a function needs to have some val-
  658.      ues passed to it). Each argument is defined in the form <type> <name>
  659.      where <type> is 'int' or 'str', and <name> is the name it should be
  660.      called by. At present, a function is not allowed to have more than 12
  661.      values passed to it.
  662.  
  663.      <variable_def> is a variable definition, as described in the above
  664.      section on that topic. Any number of variables may be declared at this
  665.      part of the function. All such variables will be local variables and
  666.      available only to this function.
  667.  
  668.      <statement> is an actual line of code. There may be as many lines of
  669.      statements in the function as needed. The format of a statement is de-
  670.      scribed below. First though, here is an example of a complete func-
  671.      tion:
  672.  
  673.           max ( int a, int b )
  674.  
  675.           {
  676.  
  677.            int result;
  678.  
  679.            if (a > b)
  680.             result = a;
  681.            else
  682.             result = b;
  683.  
  684.            return result;
  685.  
  686.           }
  687.  
  688.      This function returns the larger (maximum) of the two values passed to
  689.      it. It could have been written much more simply (without the use of
  690.      the variable), but was written this way so that all the function ele-
  691.      ments would be there.
  692.  
  693.  
  694.      3.4  Statements
  695.      ──────────────────────────────────────────────────────────────────────
  696.  
  697.      A statement is the basic element of code. A statement ALWAYS ends with
  698.      a semicolon character (;). In any location where a statement is ac-
  699.      ceptable, you may use a group of statements, by enclosing them all in
  700.      curly braces (more on this below). There are many types of statements,
  701.      including: expression, if, while, do...while, for, return, break, con-
  702.      tinue, and goto statements. Each type has several different parts.
  703.      Telix v3.21 - SALT Programming                 Program Structure    11
  704.  
  705.  
  706.  
  707.      3.4.1  The Expression statement
  708.  
  709.      The 'expression' statement is the simplest and most common type of
  710.      statement. Its format is
  711.  
  712.           <expression>;
  713.  
  714.      where <expression> is any expression. Example are:
  715.  
  716.           result = 20;
  717.           password = "Beef";
  718.           pause(20);
  719.           num = 20 * max(a, b);
  720.  
  721.      Do not forget the semicolon character at the end of the statement. If
  722.      you do, the compiler will think that the next statement is part of the
  723.      current one, and will report some unexpected error.
  724.  
  725.  
  726.      3.4.2  The If statement
  727.  
  728.      An 'if' statement is used when a statement or group of statements
  729.      should be evaluated only if a condition is true. The format for an
  730.      'if' statement is as follows:
  731.  
  732.           if (<expression>)
  733.             <statement>
  734.  
  735.      <statement> is any statement as described above and below (that is, an
  736.      expression, if, while, do...while, for, return, break, or continue
  737.      statement), and will only be executed if <expression> evaluates to
  738.      non-zero. By using curly braces around them, a whole group of state-
  739.      ments may be conditionally evaluated. Some examples are:
  740.  
  741.           if (result == -1)
  742.             prints("ERROR!");
  743.  
  744.           if (num_tries > maximum)
  745.             return 0;
  746.  
  747.           if (month > 10 && day < 20)
  748.            {
  749.             clear();
  750.             prints("In range.");
  751.             return 1;
  752.            }
  753.  
  754.      An alternate form of the if statement is:
  755.  
  756.           if (<expression>)
  757.             <statement1>
  758.           else
  759.             <statement2>
  760.  
  761.      In this case, if <expression> evaluates to non-zero (TRUE),
  762.      <statement1> is executed, otherwise <statement2> is executed. Again,
  763.      Telix v3.21 - SALT Programming                 Program Structure    12
  764.  
  765.  
  766.  
  767.      multiple statements may be used instead by grouping them in curly
  768.      braces. Some examples are:
  769.  
  770.           if (stat == -1)
  771.             prints("Error status returned.");
  772.           else
  773.             prints("Function finished without problems.");
  774.  
  775.           if (level < 10)
  776.            {
  777.             alarm(1);
  778.             prints("Warning!");
  779.            }
  780.           else
  781.             prints("Everything's ok.");
  782.  
  783.      Since the statement to be executed conditionally can be of any type,
  784.      that means that any number of if statement can be nested if needed.
  785.      For example:
  786.  
  787.           if (num < 10)
  788.             if (!error)
  789.               if (read != 0)
  790.                 return 1;
  791.  
  792.      This also means that something like the following is legal:
  793.  
  794.           if (value == 10)
  795.             do_this();
  796.           else if (value == 100)
  797.             do_that();
  798.           else if (value == 1000)
  799.             do_something_else();
  800.           else
  801.             do_whatever();
  802.  
  803.      What is really happening here is that each if statement is being
  804.      nested after the else portion of the previous one. The above example
  805.      could also be written as:
  806.  
  807.           if (value == 10)
  808.             do_this();
  809.           else
  810.             if (value == 100)
  811.               do_that();
  812.             else
  813.               if (value == 1000)
  814.                 do_something_else();
  815.               else
  816.                 do_whatever();
  817.  
  818.      Any amount of nesting is theoretically legal, but the compiler does
  819.      have a limit due to memory constraints.
  820.  
  821.      While you may write the code in any way which suits you, it is recom-
  822.      mended that you use indenting, for clarity. Indenting your code at the
  823.      proper places makes it a lot easier to read.
  824.      Telix v3.21 - SALT Programming                 Program Structure    13
  825.  
  826.  
  827.  
  828.      A very common error to watch out for is accidentally placing a semi-
  829.      colon after the parenthesis ending the expression. For example, if the
  830.      following is run:
  831.  
  832.           if (num == 10);
  833.             prints("Num is equal to 10);
  834.  
  835.      the string would always be printed, no matter what num was equal to.
  836.      This is because the semicolon after the parenthesis ending the expres-
  837.      sion signifies the end of the statement. In the above case, it would
  838.      just be a null (empty) statement.
  839.  
  840.  
  841.      3.4.3  The While statement
  842.  
  843.      The while statement is used to loop continuously while a certain con-
  844.      dition is true. It has the form
  845.  
  846.           while (<expression>)
  847.             <statement>
  848.  
  849.      <statement> would continue to be repeated over and over while
  850.      <expression> evaluated to non-zero (TRUE). Note that if the expression
  851.      evaluates to 0 (FALSE) from the beginning, the statement will never be
  852.      executed. Again, multiple statements may be used by surrounding them
  853.      in curly braces. A few examples are:
  854.  
  855.           while (stat != -1)
  856.             stat = myfunc();
  857.  
  858.           while (num < 100)
  859.             {
  860.              printn(num);
  861.              prints("");
  862.              num = num + 1;
  863.             }
  864.  
  865.           while (1)
  866.             {
  867.              if (func1())
  868.                return 0;
  869.  
  870.              func2();
  871.             }
  872.  
  873.      Again, be careful to not place a semicolon after the parenthesis end-
  874.      ing the expression.
  875.  
  876.  
  877.      3.4.4  The Do...While statement
  878.  
  879.      The do...while statement is similar to the while statement and has the
  880.      form:
  881.  
  882.           do
  883.             <statement>
  884.           while (<expression>);
  885.      Telix v3.21 - SALT Programming                 Program Structure    14
  886.  
  887.  
  888.  
  889.  
  890.      <statement> will be executed at least once and will continue to be ex-
  891.      ecuted repeatedly until the expression becomes 0 (FALSE). A few exam-
  892.      ples are:
  893.  
  894.           do
  895.             stat = func1();
  896.           while (stat != -1);
  897.  
  898.           do
  899.            {
  900.             prints("hello");
  901.             num = num + 1;
  902.            }
  903.           while (num < 100);
  904.  
  905.  
  906.      3.4.5  The For statement
  907.  
  908.      The for statement is used to loop continuously while a certain condi-
  909.      tion is true. The advantages over the while statement is that a count
  910.      variable can be initialized and incremented quite easily. The for
  911.      statement has the form:
  912.  
  913.           for (<expression1>; <expression2>; <expression3>)
  914.             <statement>
  915.  
  916.      The first expression is the one that should initialize the count vari-
  917.      able. For example, if you wanted to count from 1 to 100, and were
  918.      keeping the count in a variable called 'num', the first expression
  919.      would be 'num = 1'. The second expression is the conditional test. As
  920.      long as it evaluates to non-zero (TRUE), the statement will be exe-
  921.      cuted. Following the above example, this expression would be
  922.      'num < 100'. The third expression is the one that is used to increment
  923.      the count variable. For the above example, it would therefore be
  924.      'num = num + 1'. This for statement differs in format from that in
  925.      most other languages, but doing it this way is actually gives the pro-
  926.      grammer a lot of power and flexibility. Note that any of the expres-
  927.      sions can be left empty, in which case they evaluate to non-zero
  928.      (TRUE). Some examples are:
  929.  
  930.           for (count = 0; count < 100; count = count + 1)
  931.            {
  932.             printn(count);
  933.             prints("");
  934.            }
  935.  
  936.           for (c = 1000; c > 0; c = c - 1)
  937.             do_this(c);
  938.  
  939.      The following would execute an infinite loop:
  940.  
  941.           for (;;)
  942.             prints("Hello!");
  943.  
  944.      Note that there is really no restriction on what the expressions are.
  945.      For example, the following is quite legal:
  946.      Telix v3.21 - SALT Programming                 Program Structure    15
  947.  
  948.  
  949.  
  950.           for (c = num = 0; c < 100 && stat != -1; c = c + 1)
  951.             {
  952.              stat = func(num);
  953.              num = func2();
  954.             }
  955.  
  956.      The statements would only be executed if c was smaller than 100 and
  957.      stat didn't equal -1.
  958.  
  959.  
  960.      3.4.6  The Return statement
  961.  
  962.      At some time, every function must be exited. If the end of the func-
  963.      tion is reached, control will automatically return to the calling
  964.      function. Very often however, it is necessary to leave a function
  965.      somewhere while only halfway through it, perhaps based on a condi-
  966.      tional test. As well, it is often necessary that a function returns a
  967.      value to the caller. The format of the return statement is:
  968.  
  969.           return <expression>;
  970.  
  971.      If the return statement is encountered anywhere in the function, con-
  972.      trol immediately returns to the function that called this function.
  973.      The expression is the value that should be returned. If no expression
  974.      is supplied, a dummy value is returned. The expression should match
  975.      they type of value that the caller of this function is expecting. That
  976.      is, if an 'int' type is expected, the expression should resolve to an
  977.      integer value. If a 'str' type is expected, the expression should re-
  978.      solve to a string value. Due to memory constraints, a local string
  979.      variable may NOT be returned from a function. Some examples are:
  980.  
  981.           return;
  982.           return 1;
  983.           return level;
  984.           return (sum + 25);
  985.           return "hello";
  986.           return (func() + 20);
  987.  
  988.      Notice that when a complex expression is returned it is usually sur-
  989.      rounded by parentheses. This is done only for clarity and is not nec-
  990.      essary. Also, it should be clear that what is returned is not the ex-
  991.      pression but what it evaluates to.
  992.  
  993.  
  994.      3.4.7  The Break statement
  995.  
  996.      Often while using a looping statement (while, do...while, for), it is
  997.      necessary to break out of (exit) the loop. The break statement serves
  998.      this purpose. When the break statement is encountered, execution of
  999.      the smallest while, do...while, or for loop is terminated, and execu-
  1000.      tion continues immediately after the terminated loop statement. It is
  1001.      an error for a break statement to appear outside of a loop. The format
  1002.      of the break statement is:
  1003.  
  1004.           break;
  1005.  
  1006.      For example, assuming you had the following code:
  1007.      Telix v3.21 - SALT Programming                 Program Structure    16
  1008.  
  1009.  
  1010.  
  1011.           int num = 0;
  1012.           while (1)
  1013.            {
  1014.             num = num + 1;
  1015.             if (num > 100)
  1016.               break;
  1017.            }
  1018.           prints("Done");
  1019.  
  1020.      Ordinarily, since there will always be a non-zero (TRUE) value in the
  1021.      conditional part of this while statement, it would execute forever.
  1022.      However, when the 'num' variable is > 100, the break statement is exe-
  1023.      cuted to exit from the loop, at which point the next statement would
  1024.      be executed (the function call to prints).
  1025.  
  1026.  
  1027.      3.4.8  The Continue statement
  1028.  
  1029.      The continue statement is used within a loop (while, do...while, or
  1030.      for statement). The continue statement has the form:
  1031.  
  1032.           continue;
  1033.  
  1034.      It is illegal for a continue statement to appear outside of a loop
  1035.      body. When a continue statement is encountered, program control is im-
  1036.      mediately transferred to the end of the body of the innermost en-
  1037.      closing while, do...while, or for statement. The effect in a while or
  1038.      do...while statement is that the condition part of the while or
  1039.      do...while statement is evaluated, and the next iteration of the loop
  1040.      occurs. For example:
  1041.  
  1042.           num = 0;
  1043.           while (num < 100000)
  1044.            {
  1045.             num = num + 1;
  1046.             if (num > 100)
  1047.              continue;
  1048.             prints("Hello");
  1049.            }
  1050.  
  1051.      The effect of the continue statement in the above loop would be that
  1052.      'Hello' would only be printed while 'num' was smaller or equal to 100,
  1053.      as the continue statement is executed when num is bigger than 100,
  1054.      which causes the rest of the loop body to be skipped. An example for
  1055.      statement would be:
  1056.  
  1057.           for (num = 0; num < 100000; num = num + 1)
  1058.            {
  1059.             if (num > 100)
  1060.              continue;
  1061.             prints("Hello");
  1062.            }
  1063.  
  1064.      The effect in this case would be the same. While 'num' is smaller or
  1065.      equal to 100, the entire loop body executes. If 'num' is greater than
  1066.      100 however, the continue statement is executed. This causes the rest
  1067.      of the loop body to be skipped, so the 'Hello' is then not printed.
  1068.      Telix v3.21 - SALT Programming                 Program Structure    17
  1069.  
  1070.  
  1071.  
  1072.      3.4.9  The Goto statement
  1073.  
  1074.      The goto statement is used to branch (jump) from one place to another,
  1075.      within a function. The use of goto statements is considered bad style.
  1076.      They can make code very hard to understand, and are in fact almost
  1077.      never necessary. For example, Telix is written mainly in the C lan-
  1078.      guage, which has a goto statement, yet except for a few pieces of pre-
  1079.      written code, the goto statement was never used nor needed. On the
  1080.      other hand, used very sparingly and properly, it can sometimes make
  1081.      some code clearer and perhaps faster. The goto statement consists of
  1082.      two parts, the 'label' or marker, which is where execution will jump
  1083.      to, and the actual goto itself. A label is defined in the form
  1084.  
  1085.           <identifier>:
  1086.  
  1087.      where <identifier> follows the same rules as for variable names. Note
  1088.      that a colon follows the name, not a semicolon. The colon character
  1089.      must immediately follow the label name, with no intervening spaces. A
  1090.      label does not have to be on a line by itself, and is not considered a
  1091.      statement by itself. The goto takes the form
  1092.  
  1093.           goto <label>;
  1094.  
  1095.      where <label> is a label elsewhere in the function defined as de-
  1096.      scribed above. Execution of the script will immediately continue fol-
  1097.      lowing the label.
  1098.  
  1099.      An example is:
  1100.  
  1101.           start:
  1102.           prints("Hello");
  1103.           goto start;
  1104.  
  1105.      This would print the word "hello" over and over, forever. There is no
  1106.      restriction on the placement of a label, so the above can be written
  1107.      as:
  1108.  
  1109.           start: prints("Hello");
  1110.           goto start;
  1111.  
  1112.      As mentioned above, there are usually better ways than using a goto
  1113.      statement. For example:
  1114.  
  1115.           int i = 0;
  1116.           do
  1117.            i = i + 1;
  1118.           while (i < 100);
  1119.  
  1120.      is clearer than the equivalent:
  1121.  
  1122.           int i = 0;
  1123.           loop:
  1124.            i = i + 1;
  1125.            if (i < 100)
  1126.             goto loop;
  1127.      Telix v3.21 - SALT Programming                 Program Structure    18
  1128.  
  1129.  
  1130.  
  1131.      One good use of a goto statement is to get out of a deeply nested
  1132.      while statements, without having to do a lot of extra checking.
  1133.      Telix v3.21 - SALT Programming                Built-in Functions    19
  1134.  
  1135.  
  1136.  
  1137.      4.  BUILT-IN FUNCTIONS
  1138.  
  1139.      Telix's SALT has quite a large number of built-in functions. These
  1140.      functions are called just as you would call your own SALT functions.
  1141.      Each function does a certain task (print something to the screen, ma-
  1142.      nipulate strings, access disk files, etc.). Each function is called
  1143.      with parameters in a certain format and returns an integer or string
  1144.      value (the return value does not have to be used and is often a dummy
  1145.      variable).
  1146.  
  1147.      The following pages contain a quick listing of the functions by type
  1148.      followed by a complete description of each function, in alphabetical
  1149.      order. The complete reference contains for each function, a summary of
  1150.      the calling format, a description of what it does, and the return
  1151.      value of the function are all given. An example of actual usage of the
  1152.      function is often given. Note that the examples are fragments of pro-
  1153.      gram code for the most part, and may not explicitly declare all needed
  1154.      variables. So that you may find related functions, each function de-
  1155.      scription has a 'See Also' section, which lists related functions.
  1156.      Telix v3.21 - SALT Programming                Built-in Functions    20
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.      4.1  Quick Listing of Functions by Type
  1164.      ──────────────────────────────────────────────────────────────────────
  1165.  
  1166.      Video Operations
  1167.  
  1168.      box, cursor_onoff, clear_scr, getx, gety, gotoxy, printc, printn,
  1169.      prints, printsc, pstra, pstraxy, scroll, status_wind, update_term
  1170.  
  1171.      String Handling
  1172.  
  1173.      copychrs, copystr, delchrs, gets, getsxy, inschrs, itos, setchr,
  1174.      setchrs, stoi, strcat, strchr, strcmpi, strlen, strlower, strmaxlen,
  1175.      strpos, strposi, strupper, subchr, subchrs, substr
  1176.  
  1177.      Character Handling
  1178.  
  1179.      isascii, isalnum, isalpha, iscntrl, isdigit, islower, isupper,
  1180.      tolower, toupper
  1181.  
  1182.      Comm Port Operations
  1183.  
  1184.      carrier, cinp_cnt, cgetc, cgetct, cputc, cputs, cputs_tr, flushbuf,
  1185.      get_baud, get_datab, get_parity, get_port, get_stopb, hangup,
  1186.      set_cparams, set_port
  1187.  
  1188.      File and File I/O Operations
  1189.  
  1190.      fclearerr, fclose, fdelete, ferror, feof, fflush, fgetc, fgets,
  1191.      fileattr, filefind, filesize, filetime, fnstrip, fopen, fputc, fputs,
  1192.      fread, frename, fseek, ftell, fwrite
  1193.  
  1194.      Keyboard Operations
  1195.  
  1196.      inkey, inkeyw, keyget, keyload, keysave, keyset
  1197.  
  1198.      Date/Time and Timer Operations
  1199.  
  1200.      curtime, date, tsec, tday, thour, time, time_up, timer_free,
  1201.      timer_restart, timer_start, timer_total, tmin, tmonth, tyear
  1202.  
  1203.      File Transfers, Capture, Printer, and Usage Log
  1204.  
  1205.      capture, printer, receive, send, transtab, usagelog, ustamp
  1206.  
  1207.      Script Management
  1208.  
  1209.      call, calld, delay_scr, is_loaded, load_scr, unload_scr
  1210.  
  1211.      Input String Matching
  1212.  
  1213.      track, track_addchr, track_free, track_hit, waitfor
  1214.      Telix v3.21 - SALT Programming                Built-in Functions    21
  1215.  
  1216.  
  1217.  
  1218.      Other Functions
  1219.  
  1220.      alarm, chatmode, delay, dial, dos, dosfunction, exittelix, helpscreen,
  1221.      loadfon, newdir, redial, redirect_dos, run, send_brk, set_defprot,
  1222.      set_terminal, show_directory, terminal, tone
  1223.      Telix v3.21 - SALT Programming                Built-in Functions    22
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.      4.2  Complete Function Reference
  1231.      ──────────────────────────────────────────────────────────────────────
  1232.  
  1233.  
  1234.  
  1235.  
  1236.      ALARM
  1237.      ──────────────────────────────────────────────────────────────────────
  1238.  
  1239.      ■  Summary
  1240.  
  1241.      alarm(int <seconds>);
  1242.  
  1243.      ■  Description
  1244.  
  1245.      The alarm functions sounds an alarm for a a duration in seconds given
  1246.      by <seconds>.
  1247.  
  1248.      ■  Return Value
  1249.  
  1250.      The <seconds> argument is returned.
  1251.  
  1252.      ■  See Also
  1253.  
  1254.      tone, _alarm_on, _sound_on
  1255.  
  1256.      ■  Example
  1257.  
  1258.      while (!inkey())
  1259.        alarm(1);
  1260.  
  1261.  
  1262.  
  1263.      BOX
  1264.      ──────────────────────────────────────────────────────────────────────
  1265.  
  1266.      ■  Summary
  1267.  
  1268.      box(int <x>, int <y>, int <x2>, int <y2>, int <style>, int <hollow>,
  1269.      int <color>);
  1270.  
  1271.      ■  Description
  1272.  
  1273.      The box function is used to create a box on the screen. The box will
  1274.      have an upper left hand corner of <x>,<y> and a lower right hand cor-
  1275.      ner of <x2>,<y2>. The box must fit within the confines of the screen.
  1276.      <color> is the color to use in drawing the box. If <hollow> is a non-
  1277.      zero (TRUE) value, the inside of the box is not cleared. <style> se-
  1278.      lects what kind of box to draw, as follows:
  1279.      Telix v3.21 - SALT Programming                Built-in Functions    23
  1280.  
  1281.  
  1282.  
  1283.           0    Spaces
  1284.           1    Single lines
  1285.           2    Double lines
  1286.           3    Single vertical lines, double horizontal lines
  1287.           4    Double vertical lines, single horizontal lines
  1288.  
  1289.      If <style> is any other value, that character is used to construct the
  1290.      sides of the box.
  1291.  
  1292.      ■  Return Value
  1293.  
  1294.      None.
  1295.  
  1296.      ■  See Also
  1297.  
  1298.      scroll
  1299.  
  1300.      ■  Example
  1301.  
  1302.      box(10, 10, 70, 20, 1, 0, 112);    // draw box in inverse color
  1303.  
  1304.  
  1305.      CALL, CALLD
  1306.      ──────────────────────────────────────────────────────────────────────
  1307.  
  1308.      ■  Summary
  1309.  
  1310.      call(str <scriptname>, <arg1>, <arg2>, <arg3>, ...);
  1311.  
  1312.      calld(str <scriptname>, <arg1>, <arg2>, <arg3>, ...);
  1313.  
  1314.      ■  Description
  1315.  
  1316.      The call function is used when one script file must call (jump into
  1317.      and then return from) another. <scriptname> is the name of the script
  1318.      file to call. If no extension is given, .SLC is assumed. <arg1>
  1319.      through <argn> are the arguments or parameters to be passed to the
  1320.      'main' function of the called script. The value returned is the value
  1321.      returned by the 'main' function of the called script, and can be an
  1322.      integer or a string value, although the called script can not return
  1323.      string variables local to itself. If the script file to be called is
  1324.      already in memory because it was previously loaded and made resident,
  1325.      or it is still executing from a previous call, it is not released but
  1326.      instead the memory image is used. This means that global variables
  1327.      will have whatever values a previous run through left in them.
  1328.  
  1329.      The calld function is exactly the same as the call function, except
  1330.      that even if an image of the indicated script file is already in mem-
  1331.      ory, a new copy is still loaded from disk. This ensures that global
  1332.      variables within the script will be set as defined in the source file,
  1333.      and that there will be enough stack space, but requires more memory
  1334.      and is slower.
  1335.  
  1336.      ■  Return Value
  1337.  
  1338.      An integer or string value representing the value returned by the main
  1339.      function of the called script file. This value must not be a string
  1340.      Telix v3.21 - SALT Programming                Built-in Functions    24
  1341.  
  1342.  
  1343.  
  1344.      variable defined within the called script, for memory reasons. if the
  1345.      indicated script can not be found or loaded, a value of -1 is re-
  1346.      turned. If the called script is aborted by the user, a value of -1 is
  1347.      returned.
  1348.  
  1349.      ■  See Also
  1350.  
  1351.      load_scr, unload_scr, is_loaded
  1352.  
  1353.      ■  Example
  1354.  
  1355.      stat = call("TEST");
  1356.      if (stat == -1)
  1357.       prints("Called script could not be loaded or was aborted!");
  1358.  
  1359.  
  1360.  
  1361.  
  1362.      CAPTURE
  1363.      ──────────────────────────────────────────────────────────────────────
  1364.  
  1365.      ■  Summary
  1366.  
  1367.      capture(str <filename>);
  1368.  
  1369.      ■  Description
  1370.  
  1371.      The capture function is used to open, close, pause, and unpause the
  1372.      Telix capture file. Depending on what the string variable <filename>
  1373.      contains, different actions will take place.
  1374.  
  1375.      If <filename> contains a valid filename (which can include a path),
  1376.      Telix opens and starts capturing data to that file.
  1377.  
  1378.      If <filename> is "*CLOSE*", and the capture file is currently open, it
  1379.      is closed.
  1380.  
  1381.      If <filename> is "*PAUSE*", and the capture file is currently open, it
  1382.      is paused.
  1383.  
  1384.      if <filename> is "*UNPAUSE*", and the capture file is currently open
  1385.      and paused, it is unpaused.
  1386.  
  1387.      If <filename> is an empty string (""), Telix takes the same action as
  1388.      if the user had pressed Alt-L while in terminal mode (which will de-
  1389.      pend on whether the capture file is currently open or closed).
  1390.  
  1391.      ■  Return Value
  1392.  
  1393.      A value of -1 is returned if there is a problem performing the indi-
  1394.      cated function, otherwise a non-zero (TRUE) value is returned.
  1395.  
  1396.      ■  See Also
  1397.  
  1398.      printer, capture_stat, _capture_fname
  1399.      Telix v3.21 - SALT Programming                Built-in Functions    25
  1400.  
  1401.  
  1402.  
  1403.      ■  Example
  1404.  
  1405.      if (capture("TELIX.CAP") == -1)
  1406.       prints("Error opening capture file!");
  1407.         ...
  1408.      capture("*PAUSE*");
  1409.      capture("*UNPAUSE*");
  1410.      capture("*CLOSE*");
  1411.  
  1412.  
  1413.  
  1414.  
  1415.      CAPTURE_STAT
  1416.      ──────────────────────────────────────────────────────────────────────
  1417.  
  1418.      ■  Summary
  1419.  
  1420.      capture_stat();
  1421.  
  1422.      ■  Description
  1423.  
  1424.      The capture_stat function returns an integer value representing the
  1425.      current status of the capture file, as follows:
  1426.  
  1427.                0    Capture File is closed
  1428.                1    Capture File is open
  1429.                2    Capture File is open and paused
  1430.  
  1431.      ■  Return Value
  1432.  
  1433.      An integer values as described above.
  1434.  
  1435.      ■  See Also
  1436.  
  1437.      capture, usage_stat
  1438.  
  1439.  
  1440.  
  1441.  
  1442.      CARRIER
  1443.      ──────────────────────────────────────────────────────────────────────
  1444.  
  1445.      ■  Summary
  1446.  
  1447.      carrier();
  1448.  
  1449.      ■  Description
  1450.  
  1451.      The carrier functions returns a non-zero (TRUE) value if the Carrier
  1452.      Detect signal coming from the modem is on (high), otherwise it returns
  1453.      a zero (FALSE) value. Note that some modems by default override the
  1454.      real state of the signal and always send a high. For this function to
  1455.      work, the modem must be told to supply the real signal. This function
  1456.      may be used to check if Telix is connected to a remote service over
  1457.      the modem, as the Carrier Detect signal should be on if there is a
  1458.      connection. Note that if you are connecting two computers via a null-
  1459.      Telix v3.21 - SALT Programming                Built-in Functions    26
  1460.  
  1461.  
  1462.  
  1463.      modem cable, the value returned will depend on the wiring of the cable
  1464.      being used.
  1465.  
  1466.      ■  Return Value
  1467.  
  1468.      non-zero (TRUE) or zero (FALSE) based on the state of the Carrier De-
  1469.      tect signal.
  1470.  
  1471.      ■  Example
  1472.  
  1473.      if (carrier())
  1474.       prints("We are online.");
  1475.  
  1476.  
  1477.      CGETC, CGETCT
  1478.      ──────────────────────────────────────────────────────────────────────
  1479.  
  1480.      ■  Summary
  1481.  
  1482.      cgetc();
  1483.  
  1484.      cgetct(int <timeout>);
  1485.  
  1486.      ■  Description
  1487.  
  1488.      The cgetc function returns the first character waiting in the received
  1489.      data communications buffer. If there are no characters in the buffer,
  1490.      a value of -1 is returned. The cinp_cnt function may be used to see if
  1491.      there are any chars waiting in the buffer.
  1492.  
  1493.      The cgetct functions returns a character from the communications port,
  1494.      waiting up to <timeout> tenths of a second for it to arrive. If a
  1495.      character is already waiting in the communications buffer, it is imme-
  1496.      diately returned. If no character is received within the timeout pe-
  1497.      riod, a value of -1 is returned.
  1498.  
  1499.      ■  Return Value
  1500.  
  1501.      An integer value as described above.
  1502.  
  1503.      ■  See Also
  1504.  
  1505.      cinp_cnt
  1506.  
  1507.      ■  Example
  1508.  
  1509.      if (cinp_cnt())
  1510.       chr = cgetc();
  1511.      if ((chr = cgetct(100)) == -1)
  1512.       prints("Timeout!");
  1513.      Telix v3.21 - SALT Programming                Built-in Functions    27
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.      CHATMODE
  1521.      ──────────────────────────────────────────────────────────────────────
  1522.  
  1523.      ■  Summary
  1524.  
  1525.      chatmode(int <echo_remote>);
  1526.  
  1527.      ■  Description
  1528.  
  1529.      The chatmode function enters the chat mode as if the user had pressed
  1530.      Alt-Y while in terminal mode, If <echo_remote> is non-zero (TRUE),
  1531.      characters typed by the remote user are echoed back to him/her, other-
  1532.      wise they are not. The echo feature is for use in Host Mode
  1533.      implementations.
  1534.  
  1535.      ■  Return Value
  1536.  
  1537.      None.
  1538.  
  1539.  
  1540.  
  1541.  
  1542.      CINP_CNT
  1543.      ──────────────────────────────────────────────────────────────────────
  1544.  
  1545.      ■  Summary
  1546.  
  1547.      cinp_cnt();
  1548.  
  1549.      ■  Description
  1550.  
  1551.      The cinp_cnt function returns the number of characters waiting in the
  1552.      received data communications buffer.
  1553.  
  1554.      ■  Return Value
  1555.  
  1556.      An integer value as described above.
  1557.  
  1558.      ■  See Also
  1559.  
  1560.      cgetc
  1561.  
  1562.      ■  Examples
  1563.  
  1564.      if (cinp_cnt() > 10)   // if more than 10 chars waiting
  1565.       handle_stuff();       //   do action
  1566.      while (!cinp_cnt())    // loop until no chars available
  1567.       ;
  1568.      if (cinp_cnt())        // if something available, get it
  1569.       c = cgetc();
  1570.      Telix v3.21 - SALT Programming                Built-in Functions    28
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.      CLEAR_SCR
  1578.      ──────────────────────────────────────────────────────────────────────
  1579.  
  1580.      ■  Summary
  1581.  
  1582.      clear_scr();
  1583.  
  1584.      ■  Description
  1585.  
  1586.      The clear_scr function clears the screen and places the cursor in the
  1587.      upper left corner at position 0,0.
  1588.  
  1589.      ■  Return Value
  1590.  
  1591.      None.
  1592.  
  1593.      ■  See Also
  1594.  
  1595.      scroll
  1596.  
  1597.  
  1598.  
  1599.  
  1600.      COPYCHRS
  1601.      ──────────────────────────────────────────────────────────────────────
  1602.  
  1603.      ■  Summary
  1604.  
  1605.      copychrs(str <source>, str <target>, int <pos>, int <count>);
  1606.  
  1607.      ■  Description
  1608.  
  1609.      The copychrs function copies a number of characters from one string
  1610.      into another, Characters from the string <source> are copied into the
  1611.      string <target> at the position <pos> (note that SALT string offsets
  1612.      start at 0, not 1 as in some languages). until <count> characters are
  1613.      copied. Only as many characters as will fit in <target> are copied.
  1614.  
  1615.      This function is very similar to substr, except that it is not string
  1616.      oriented, and does not stop copying characters when a 0 value is en-
  1617.      countered.
  1618.  
  1619.      The substr function copies a portion of one string to another. Char-
  1620.      acters from position <pos> in string <source> are copied until into
  1621.      string <target> (note that SALT string offsets start at 0, not 1 as in
  1622.      some languages). Characters are copied until a 0 (NULL) value is en-
  1623.      countered (normally at the end of every string), or <max> characters
  1624.      are copied. A 0 (NULL) is always copied at the end of the target
  1625.      string. The 0 does not count as part of the <max>. Only as many char-
  1626.      acters as will fit in <target> are copied.
  1627.  
  1628.      ■  Return Value
  1629.  
  1630.      None.
  1631.      Telix v3.21 - SALT Programming                Built-in Functions    29
  1632.  
  1633.  
  1634.  
  1635.      ■  See Also
  1636.  
  1637.      copystr, subchrs, substr
  1638.  
  1639.  
  1640.  
  1641.  
  1642.      COPYSTR
  1643.      ──────────────────────────────────────────────────────────────────────
  1644.  
  1645.      ■  Summary
  1646.  
  1647.      copystr(str <source>, str <target>, int <pos>, int <count>);
  1648.  
  1649.      ■  Description
  1650.  
  1651.      The copystr function copies one string into another at a certain po-
  1652.      sition. Characters in string <source> are copied into string <target>
  1653.      at position <pos> (note that SALT string offsets start at 0, not 1 as
  1654.      in some languages). Characters are copied until a 0 (NULL) value is
  1655.      encountered (normally at the end of every string), or <max> characters
  1656.      are copied. A 0 (NULL) is always copied at the end of the target
  1657.      string. The 0 does not count as part of the <max>. Only as many char-
  1658.      acters as will fit in <target> are copied.
  1659.  
  1660.      ■  Return Value
  1661.  
  1662.      None.
  1663.  
  1664.      ■  See Also
  1665.  
  1666.      copychrs, substr, subchrs
  1667.  
  1668.  
  1669.  
  1670.  
  1671.      CPUTC
  1672.      ──────────────────────────────────────────────────────────────────────
  1673.  
  1674.      ■  Summary
  1675.  
  1676.      cputc(int <character>);
  1677.  
  1678.      ■  Description
  1679.  
  1680.      The cputc function sends <character> to the communications port. This
  1681.      is the ASCII value of the character to be sent.
  1682.  
  1683.      ■  Return Value
  1684.  
  1685.      A non-zero (TRUE) value is returned unless the character can not be
  1686.      sent for some reason, in which case a value of -1 is returned.
  1687.  
  1688.      ■  See Also
  1689.  
  1690.      cputs
  1691.      Telix v3.21 - SALT Programming                Built-in Functions    30
  1692.  
  1693.  
  1694.  
  1695.      ■  Example
  1696.  
  1697.      cputc('A');
  1698.      cputc(27);          // send Escape to the comm port
  1699.      cputc('^M');        // send Ctrl-M (Carriage Return)
  1700.      cputc(inkeyw());
  1701.  
  1702.  
  1703.  
  1704.  
  1705.      CPUTS
  1706.      ──────────────────────────────────────────────────────────────────────
  1707.  
  1708.      ■  Summary
  1709.  
  1710.      cputs(str <outstr>);
  1711.  
  1712.      ■  Description
  1713.  
  1714.      The cputs function sends the passed string out over the modem port. A
  1715.      Carriage Return and Line Feed are NOT added after the string.
  1716.  
  1717.      ■  Return Value
  1718.  
  1719.      None.
  1720.  
  1721.      ■  See Also
  1722.  
  1723.      cputs_tr
  1724.  
  1725.      ■  Example
  1726.  
  1727.      cputs("Good-bye");
  1728.      str password[] = "mypass";
  1729.      cputs(password);
  1730.  
  1731.  
  1732.  
  1733.  
  1734.      CPUTS_TR
  1735.      ──────────────────────────────────────────────────────────────────────
  1736.  
  1737.      ■  Summary
  1738.  
  1739.      cputs_tr(str <outstr>);
  1740.  
  1741.      ■  Description
  1742.  
  1743.      The cputs_tr function sends the passed string out over the modem port,
  1744.      but pays attention to two output string translation characters,  ^ and
  1745.      ~, described in the Telix manual. This function is really only useful
  1746.      for sending the modem control strings that the user has defined in the
  1747.      Configuration Menu.
  1748.  
  1749.      ■  Return Value
  1750.  
  1751.      None.
  1752.      Telix v3.21 - SALT Programming                Built-in Functions    31
  1753.  
  1754.  
  1755.  
  1756.      ■  See Also
  1757.  
  1758.      cputs
  1759.  
  1760.      ■  Example
  1761.  
  1762.      cputs_tr(_modem_init);
  1763.      cputs_tr("good-bye~yes^M");
  1764.  
  1765.  
  1766.  
  1767.  
  1768.      CURSOR_ONOFF
  1769.      ──────────────────────────────────────────────────────────────────────
  1770.  
  1771.      ■  Summary
  1772.  
  1773.      cursor_onoff(int <state>);
  1774.  
  1775.      ■  Description
  1776.  
  1777.      The cursor_onoff functions turn the blinking cursor on or off (makes
  1778.      it disappear or reappear), depending on whether state is non-zero
  1779.      (TRUE) or zero (FALSE).
  1780.  
  1781.      ■  Return Value
  1782.  
  1783.      None.
  1784.  
  1785.  
  1786.  
  1787.  
  1788.      CURTIME
  1789.      ──────────────────────────────────────────────────────────────────────
  1790.  
  1791.      ■  Summary
  1792.  
  1793.      curtime();
  1794.  
  1795.      ■  Description
  1796.  
  1797.      The curtime function returns the current date/time as the number of
  1798.      seconds since Jan 1, 1970. A date/time value in this format is used by
  1799.      many SALT functions.
  1800.  
  1801.      ■  Return Value
  1802.  
  1803.      An integer value as described above.
  1804.  
  1805.      ■  See Also
  1806.  
  1807.      date, time, tyear, tmonth, tday, thour, tmin, tsec
  1808.  
  1809.      ■  Example
  1810.  
  1811.      // Print the current date
  1812.      Telix v3.21 - SALT Programming                Built-in Functions    32
  1813.  
  1814.  
  1815.  
  1816.      int t;
  1817.      str s[64];
  1818.  
  1819.      t = curtime();
  1820.      date(t, s);
  1821.      prints(s);
  1822.  
  1823.  
  1824.  
  1825.  
  1826.      DATE
  1827.      ──────────────────────────────────────────────────────────────────────
  1828.  
  1829.      ■  Summary
  1830.  
  1831.      date(int <timeval>, str <buffer>);
  1832.  
  1833.      ■  Description
  1834.  
  1835.      The date function writes out a date in <buffer> in the form mm/dd/yy,
  1836.      dd/mm/yy, or yy/mm/dd (which is based on the system variable
  1837.      _date_format). <timeval> is the date, represented as the number of
  1838.      seconds since Jan 1, 1970. Time values in this form are returned by
  1839.      the curtime and filetime functions, among others.
  1840.  
  1841.      ■  Return Value
  1842.  
  1843.      None.
  1844.  
  1845.      ■  See Also
  1846.  
  1847.      time, curtime, filetime
  1848.  
  1849.      ■  Example
  1850.  
  1851.      str s[16];
  1852.      printsc("The current date is ");
  1853.      date(curtime(), s);
  1854.      prints(s);
  1855.  
  1856.  
  1857.      DELAY, DELAY_SCR
  1858.      ──────────────────────────────────────────────────────────────────────
  1859.  
  1860.      ■  Summary
  1861.  
  1862.      delay(int <duration>);
  1863.  
  1864.      delay_scr(int <duration>);
  1865.  
  1866.      ■  Description
  1867.  
  1868.      The delay function pauses Telix for a length of time specified in
  1869.      tenths of a second by <duration>. During this pause, everything is
  1870.      shut off except the asynchronous reception of characters from the comm
  1871.      port.
  1872.      Telix v3.21 - SALT Programming                Built-in Functions    33
  1873.  
  1874.  
  1875.  
  1876.      The delay_scr function pauses only the execution of the current script
  1877.      file for the indicated duration. During that time, characters coming
  1878.      in from the serial port are printed on the terminal screen, while user
  1879.      keystrokes are also processed.
  1880.  
  1881.      ■  Return Value
  1882.  
  1883.      The <duration> argument is returned.
  1884.  
  1885.  
  1886.  
  1887.  
  1888.      DELCHRS
  1889.      ──────────────────────────────────────────────────────────────────────
  1890.  
  1891.      ■  Summary
  1892.  
  1893.      delchrs(str <s>, int <pos>, int <num>);
  1894.  
  1895.      ■  Description
  1896.  
  1897.      The delchrs function is used to remove or delete a number of charac-
  1898.      ters in a string at a certain position. <s> is the string to handle.
  1899.      <pos> is the position at which <num> characters will be deleted (note
  1900.      that the first characters in a SALT string has the position 0). Re-
  1901.      maining characters in the string are be shifted left.
  1902.  
  1903.      ■  Return Value
  1904.  
  1905.      None.
  1906.  
  1907.      ■  See Also
  1908.  
  1909.      inschrs
  1910.  
  1911.      ■  Example
  1912.  
  1913.      // remove all but the first and last characters in a string
  1914.  
  1915.      str s[] = "0123456789";
  1916.      delchrs(s, 1, strlen(s) - 2);
  1917.  
  1918.  
  1919.  
  1920.  
  1921.      DIAL
  1922.      ──────────────────────────────────────────────────────────────────────
  1923.  
  1924.      ■  Summary
  1925.  
  1926.      dial(str <dialstr>, int <maxtries>, int <no_link>);
  1927.  
  1928.      ■  Description
  1929.  
  1930.      The dial function dials the entries specified in <dialstr>. The en-
  1931.      tries should be entered in the same format as used when typing entries
  1932.      in the dialing directory. If <dialstr> is empty (""), the dialing di-
  1933.      Telix v3.21 - SALT Programming                Built-in Functions    34
  1934.  
  1935.  
  1936.  
  1937.      rectory is displayed. <maxtries> is the maximum number of dialing at-
  1938.      tempts. For example, if the string contains one entry, and <maxtries>
  1939.      is equal to 5, Telix will attempt to dial the number 5 times. If five
  1940.      entries are indicated, and <maxtries> is equal to 5, each number will
  1941.      only be attempted once.  If <maxtries> is 0, dialing will continue un-
  1942.      til a connection is established. If an entry is connected to, and has
  1943.      a linked script file attached, that script will be run, unless
  1944.      <no_link> is non-zero (TRUE).
  1945.  
  1946.      ■  Return Value
  1947.  
  1948.      If there was a connection, the dial function returns the entry number
  1949.      of the entry which was connected to (or 1 if a manual number was di-
  1950.      aled). If there was no connection established, 0 is returned. If the
  1951.      <dialstr> has a bad format, -1 is returned.
  1952.  
  1953.      Also, when a connection is successfully established, the entry number
  1954.      of the entry connected to is placed in the system variable
  1955.      _entry_enum, while the name of the entry connected to is placed in the
  1956.      system variable _entry_name.
  1957.  
  1958.      ■  See Also
  1959.  
  1960.      redial
  1961.      _entry_enum, _entry_name
  1962.  
  1963.      ■  Example
  1964.  
  1965.      int stat;
  1966.      dial("10 15", 0);
  1967.      dial("m967-1111", 5);
  1968.      stat = dial(number_list, 0);
  1969.  
  1970.  
  1971.  
  1972.  
  1973.      DOS
  1974.      ──────────────────────────────────────────────────────────────────────
  1975.  
  1976.      ■  Summary
  1977.  
  1978.      dos(str <command>, int <mode>);
  1979.  
  1980.      ■  Description
  1981.  
  1982.      The dos function calls the DOS command interpreter (usually COM-
  1983.      MAND.COM, and gives it the passed command string. If the <command>
  1984.      string is empty (""), Telix will drop into a DOS shell, as if the Alt-
  1985.      J command had been executed. Make sure that if you specify a command
  1986.      or program that expects user input you are on hand to give it. The
  1987.      <mode> argument specifies several options, as follows:
  1988.  
  1989.           0    Original screen is restored when command is completed.
  1990.           1    When command is completed, the user is prompted to press a
  1991.                key and screen is restored as soon as it is pressed.
  1992.           2    Original screen is not restored when command is completed
  1993.      Telix v3.21 - SALT Programming                Built-in Functions    35
  1994.  
  1995.  
  1996.  
  1997.      This function is very similar to the run function. It should be used
  1998.      when an internal DOS command is needed or a DOS shell is needed, oth-
  1999.      erwise run is preferable as it uses less memory and executes faster.
  2000.  
  2001.      ■  Return Value
  2002.  
  2003.      The dos function returns a -1 if the command processor can not be
  2004.      found or there is not enough memory to load it, otherwise a 0 is re-
  2005.      turned.
  2006.  
  2007.      ■  See Also
  2008.  
  2009.      run, dosfunction
  2010.  
  2011.      ■  Example
  2012.  
  2013.      dos("copy a:*.* c:", 1);
  2014.  
  2015.  
  2016.  
  2017.  
  2018.      DOSFUNCTION
  2019.      ──────────────────────────────────────────────────────────────────────
  2020.  
  2021.      ■  Summary
  2022.  
  2023.      dosfunction();
  2024.  
  2025.      ■  Description
  2026.  
  2027.      The dosfunction function calls up the 'DOS Functions' menu, as if the
  2028.      user had pressed Alt-F while in terminal mode.
  2029.  
  2030.      ■  Return Value
  2031.  
  2032.      None.
  2033.  
  2034.      ■  See Also
  2035.  
  2036.      dos, run
  2037.  
  2038.  
  2039.  
  2040.  
  2041.      EXITTELIX
  2042.      ──────────────────────────────────────────────────────────────────────
  2043.  
  2044.      ■  Summary
  2045.  
  2046.      exittelix(int <returncode>, int <hangup>);
  2047.  
  2048.      ■  Description
  2049.  
  2050.      The exittelix function closes any currently open log file, and exits
  2051.      Telix to DOS, as if the user had pressed Alt-X while in terminal mode.
  2052.      The <returncode> argument is the value that should be returned to DOS.
  2053.      This value can be read by whatever called Telix (e.g., a batch file
  2054.      Telix v3.21 - SALT Programming                Built-in Functions    36
  2055.  
  2056.  
  2057.  
  2058.      using the errorlevel command). The <hangup> option affects what hap-
  2059.      pens if Telix is online. If it is set to non-zero (TRUE), Telix will
  2060.      hang-up before returning to DOS, otherwise the connection will not be
  2061.      disturbed.
  2062.  
  2063.      ■  Return Value
  2064.  
  2065.      Since this functions causes Telix to terminate, there is never any re-
  2066.      turn from it.
  2067.  
  2068.      ■  Example
  2069.  
  2070.      exittelix(0, 1);
  2071.      exittelix(100, 0);
  2072.  
  2073.  
  2074.      FCLEARERR
  2075.      ──────────────────────────────────────────────────────────────────────
  2076.  
  2077.      ■  Summary
  2078.  
  2079.      fclearerr(int <fh>);
  2080.  
  2081.      ■  Description
  2082.  
  2083.      The fclearerr function clears the error flag assigned to the open file
  2084.      represented by file handle <fh>. It also clears the End Of File flag
  2085.      for that file as well.
  2086.  
  2087.      ■  Return Value
  2088.  
  2089.      None.
  2090.  
  2091.      ■  See Also
  2092.  
  2093.      ferror, feof
  2094.  
  2095.      ■  Example
  2096.  
  2097.      int f;
  2098.      f = fopen("test.dat", "r");
  2099.         ...
  2100.      if (ferror(f))
  2101.       fclearerr(f);
  2102.  
  2103.  
  2104.      FCLOSE
  2105.      ──────────────────────────────────────────────────────────────────────
  2106.  
  2107.      ■  Summary
  2108.  
  2109.      fclose(int <fh>);
  2110.  
  2111.      ■  Description
  2112.  
  2113.      The fclose functions closes the file represented by the file handle
  2114.      <fh>, which must previously been opened for reading or writing with
  2115.      Telix v3.21 - SALT Programming                Built-in Functions    37
  2116.  
  2117.  
  2118.  
  2119.      the fopen function. If the file was opened for writing, any data which
  2120.      is still buffered and waiting to be written out to disk is written be-
  2121.      fore the file is closed.
  2122.  
  2123.      ■  Return Value
  2124.  
  2125.      A return value of -1 indicates a problem closing the file.
  2126.  
  2127.      ■  See Also
  2128.  
  2129.      fopen
  2130.  
  2131.      ■  Example
  2132.  
  2133.      int f;
  2134.      f = fopen("test.dat", "w");
  2135.         ...
  2136.      fclose(f);
  2137.  
  2138.  
  2139.      FDELETE
  2140.      ──────────────────────────────────────────────────────────────────────
  2141.  
  2142.      ■  Summary
  2143.  
  2144.      fdelete(str <filename>);
  2145.  
  2146.      ■  Description
  2147.  
  2148.      The fdelete function is used to delete a disk file from within a
  2149.      script. <filename> is the name of the file to delete. A full drive and
  2150.      path may be specified as part of the filename, and case is not signif-
  2151.      icant, but wildcard characters (* or ?) may NOT be part of the file-
  2152.      name.
  2153.  
  2154.      ■  Return Value
  2155.  
  2156.      A value of -1 is returned if there is a problem deleting the file, 0
  2157.      otherwise.
  2158.  
  2159.      ■  See Also
  2160.  
  2161.      frename
  2162.  
  2163.      ■  Example
  2164.  
  2165.      fdelete("C:\UTIL\TLX\TELIX.CAP");    // delete an old capture file
  2166.  
  2167.  
  2168.  
  2169.  
  2170.      FEOF
  2171.      ──────────────────────────────────────────────────────────────────────
  2172.  
  2173.      ■  Summary
  2174.  
  2175.      feof(int <fh>);
  2176.      Telix v3.21 - SALT Programming                Built-in Functions    38
  2177.  
  2178.  
  2179.  
  2180.      ■  Description
  2181.  
  2182.      The feof function determines if the file position for the open file
  2183.      represented by the file handle <fh> is at the end-of-file position.
  2184.  
  2185.      ■  Return Value
  2186.  
  2187.      A non-zero (TRUE) value is returned if the file position is at the end
  2188.      of the file.
  2189.  
  2190.      ■  See Also
  2191.  
  2192.      ferror
  2193.  
  2194.      ■  Example
  2195.  
  2196.      int f, chr;
  2197.      f = fopen("test.dat", "r");
  2198.      while ((chr = fgetc(f)) != -1)    // print contents of file
  2199.       printc(chr);
  2200.      if (feof(f))
  2201.       prints("Reached end of file.");
  2202.      else
  2203.       prints("Error reading file");
  2204.  
  2205.  
  2206.      FERROR
  2207.      ──────────────────────────────────────────────────────────────────────
  2208.  
  2209.      ■  Summary
  2210.  
  2211.      ferror(int <fh>);
  2212.  
  2213.      ■  Description
  2214.  
  2215.      The ferror function checks the error flag for a file represented by
  2216.      the file handle <fh>. The error flag stays set until it is cleared
  2217.      with fclearerr or the file is closed.
  2218.  
  2219.      ■  Return Value
  2220.  
  2221.      A non-zero (TRUE) value is returned if the file's error flag is set.
  2222.  
  2223.      ■  See Also
  2224.  
  2225.      fclearerr, feof
  2226.  
  2227.      ■  Example
  2228.  
  2229.      int f;
  2230.      f = fopen("test.dat", "r");       // open file only for reading
  2231.      fputs("This should set the error flag!", f);
  2232.      if (ferror(f))
  2233.       prints("Error writing to file!");
  2234.      Telix v3.21 - SALT Programming                Built-in Functions    39
  2235.  
  2236.  
  2237.  
  2238.      FFLUSH
  2239.      ──────────────────────────────────────────────────────────────────────
  2240.  
  2241.      ■  Summary
  2242.  
  2243.      fflush(int <fh>);
  2244.  
  2245.      ■  Description
  2246.  
  2247.      The fflush function flushes the buffer associated with the file rep-
  2248.      resented by file handle <fh>. If the file is opened for writing, any
  2249.      characters in the buffer are written. If the file is opened for read-
  2250.      ing, the buffer is cleared.
  2251.  
  2252.      ■  Return Value
  2253.  
  2254.      A value of -1 is returned if there is a problem flushing the buffer.
  2255.  
  2256.      ■  See Also
  2257.  
  2258.      fopen, fclose
  2259.  
  2260.  
  2261.      FGETC
  2262.      ──────────────────────────────────────────────────────────────────────
  2263.  
  2264.      ■  Summary
  2265.  
  2266.      fgetc(int <fh>);
  2267.  
  2268.      ■  Description
  2269.  
  2270.      The fgetc function returns the next character from the file rep-
  2271.      resented by the file handle <fh>. The file must have been opened for
  2272.      reading or from reading and writing, using the fopen function.
  2273.  
  2274.      ■  Return Value
  2275.  
  2276.      Returns the character read if successful, or -1 if the end of the file
  2277.      has been reached or an error is encountered.
  2278.  
  2279.      ■  See Also
  2280.  
  2281.      fopen, fputc
  2282.  
  2283.      ■  Example
  2284.  
  2285.      int f;
  2286.      f = fopen("test.dat", "r");
  2287.      while (!feof(f))        // print all the characters in the file
  2288.       printc(fgetc(f));
  2289.      Telix v3.21 - SALT Programming                Built-in Functions    40
  2290.  
  2291.  
  2292.  
  2293.      FGETS
  2294.      ──────────────────────────────────────────────────────────────────────
  2295.  
  2296.      ■  Summary
  2297.  
  2298.      fgets(str <buffer>, int <n>, int <fh>);
  2299.  
  2300.      ■  Description
  2301.  
  2302.      The fgets function reads characters from the open file indicated by
  2303.      the file handle <fh> into the string variable <buffer>. Reading stops
  2304.      when a newline (Line Feed) character is read, and end-of-file is en-
  2305.      countered, a read error occurs, or <n> characters have been read. The
  2306.      Line Feed character (and the Carriage Return that usually precedes it
  2307.      on MS-DOS systems) is not kept as part of the string.
  2308.  
  2309.      Important: The SALT implementation of the fgets() function differs
  2310.      from the C language function of the same name. While both implemen-
  2311.      tations read until the Line Feed character, C keeps that character as
  2312.      part of the input string, while SALT doesn't. This change was made be-
  2313.      cause in almost every case, the Line Feed is not needed, and would
  2314.      otherwise have to be manually stripped by the script after every read.
  2315.  
  2316.      ■  Return Value
  2317.  
  2318.      A value of -1 is returned if there is a read error, or if there is an
  2319.      end-of-file before any characters can be read.
  2320.  
  2321.      ■  See Also
  2322.  
  2323.      fopen, fputs
  2324.  
  2325.      ■  Example
  2326.  
  2327.      int f;
  2328.      str s[100];
  2329.      f = fopen("test.dat", "r");
  2330.      while (!feof(f))         // print out contents of text file
  2331.       {
  2332.        fgets(s, 100, f);
  2333.        printsc(s);
  2334.       }
  2335.  
  2336.  
  2337.      FILEATTR
  2338.      ──────────────────────────────────────────────────────────────────────
  2339.  
  2340.      ■  Summary
  2341.  
  2342.      fileattr(str <filespec>);
  2343.  
  2344.      ■  Description
  2345.  
  2346.      Under the MS-DOS file system, files have a certain attributes which
  2347.      can determine their functions or the way certain things behave. For
  2348.      example if a file has the 'hidden' bit set as part of its attribute
  2349.      Telix v3.21 - SALT Programming                Built-in Functions    41
  2350.  
  2351.  
  2352.  
  2353.      byte, when you do a DOS dir command, the file is not shown. Similarly,
  2354.      if a file has the read only bit set, you may not overwrite it.
  2355.  
  2356.      The fileattr function returns an integer value representing the at-
  2357.      tributes of a specified file. <filespec> is the name of the file and
  2358.      may include a drive and directory portion, as well as the DOS wildcard
  2359.      characters * and ?.
  2360.  
  2361.      The value returned is a total of the following attributes.
  2362.  
  2363.           1    Read only file.
  2364.  
  2365.           2    Hidden file. The file is not listed when the DOS dir command
  2366.                is executed.
  2367.  
  2368.           4    System file. The file is not listed when the DOS dir command
  2369.                is executed.
  2370.  
  2371.           8    Volume label. This is the volume name of the disk.
  2372.  
  2373.           16   Subdirectory. This is a subdirectory name.
  2374.  
  2375.           32   Archive bit. This is set by DOS whenever a file has been
  2376.                written to and is then used by some backup software to check
  2377.                if a file has been modified since last backed-up.
  2378.  
  2379.      Each of these values is a certain bit in a byte. To test for the ex-
  2380.      istence of an attribute, the bitwise AND operator should be used. For
  2381.      example, the following fragment would check if the read only bit in an
  2382.      attribute is set:
  2383.  
  2384.      if (attrib & 1)
  2385.       ...
  2386.  
  2387.      If <filespec> is blank (""), then the attributes of the last file
  2388.      found with the filefind function is returned. Note that calling file-
  2389.      size or filetime in the meantime with a non-blank filename would in-
  2390.      stead make this call return the attributes of files found with those
  2391.      functions, as they use the same buffer.
  2392.  
  2393.      ■  Return Value
  2394.  
  2395.      An integer value representing the combined attributes of the indicated
  2396.      file is returned, or a value of -1 is returned if the indicated file
  2397.      could not be found.
  2398.  
  2399.      ■  See Also
  2400.  
  2401.      filefind, filesize, filetime
  2402.  
  2403.      ■  Example
  2404.  
  2405.      int attr;
  2406.      str filename[64];
  2407.      gets(filename, 64);
  2408.      attr = fileattr(filename);
  2409.      if (attr & 6)      // system _and_ hidden added together
  2410.      Telix v3.21 - SALT Programming                Built-in Functions    42
  2411.  
  2412.  
  2413.  
  2414.       prints("This file is marked as hidden and system");
  2415.  
  2416.  
  2417.      FILEFIND
  2418.      ──────────────────────────────────────────────────────────────────────
  2419.  
  2420.      ■  Summary
  2421.  
  2422.      filefind(str <filespec>, int <attrib>, str <buffer>);
  2423.  
  2424.      ■  Description
  2425.  
  2426.      The filefind function is used to search for the existence of one or
  2427.      more files or disk directories. Filefind puts in <buffer> the name of
  2428.      the first file matching <filespec>, which may include a drive and path
  2429.      as well as a filename, and may use the DOS wildcard characters * and ?
  2430.      (e.g., "*.*", "C:\TELIX\TELIX.EXE", "SCRIPTS\TEST??.*"). <attrib> is
  2431.      the attribute (also see fileattr) which files must match. The at-
  2432.      tribute is obtained by adding certain values as follows:
  2433.  
  2434.           0    Normal files and read only files
  2435.           2    Hidden files
  2436.           4    System files
  2437.           8    Disk volume label
  2438.           16   Subdirectory
  2439.  
  2440.      If the attribute is 0, only normal (and read-only) files are found. If
  2441.      the volume label is selected, only volume labels will be returned. Any
  2442.      other selected attribute or combination (addition) of attributes re-
  2443.      sults in those files and all normal files being matched.
  2444.  
  2445.      When a matching file, directory, or volume name is found, it is put in
  2446.      <buffer> (note that the drive and path portion of filespec are not
  2447.      copied), and a non-zero (TRUE) value is returned. The size, date/time,
  2448.      and attributes of the matched file can be seen with the filesize,
  2449.      filetime, and fileattr functions, respectively.  If no files matching
  2450.      the file specification are found, a zero (FALSE) value is returned.
  2451.  
  2452.      If <filespec> is blank (""), then filefind searches for the next
  2453.      matching file. Note that this will not work after an intervening call
  2454.      to filesize, filetime, or fileattr with a non-blank filename, as the
  2455.      same buffer is used for searches and to keep data.
  2456.  
  2457.      ■  Return Value
  2458.  
  2459.      A non-zero (TRUE) value is returned if a file matching the speci-
  2460.      fication was found, otherwise a value of zero (FALSE) is returned.
  2461.  
  2462.      ■  See Also
  2463.  
  2464.      filesize, filetime, fileattr
  2465.  
  2466.      ■  Example
  2467.  
  2468.      // show all normal files in the current directory
  2469.      str buf[16], fspec[16] = "*.*";
  2470.      while (filefind(fspec, 0, buf) != 0)
  2471.      Telix v3.21 - SALT Programming                Built-in Functions    43
  2472.  
  2473.  
  2474.  
  2475.       {
  2476.        prints(buf);    // show file found
  2477.        fspec = "";     // so we can continue searching for files
  2478.       }
  2479.  
  2480.  
  2481.      FILESIZE
  2482.      ──────────────────────────────────────────────────────────────────────
  2483.  
  2484.      ■  Summary
  2485.  
  2486.      filesize(str <filespec>);
  2487.  
  2488.      ■  Description
  2489.  
  2490.      The filesize function returns the size in bytes of the specified file.
  2491.      <filespec> is the name of the file and may include a drive and direc-
  2492.      tory portion, as well as the DOS wildcard characters * and ?.
  2493.  
  2494.      If <filespec> is blank (""), then the size of the last file found with
  2495.      the filefind function is returned. Note that calling filetime or
  2496.      fileattr in the meantime with a non-blank filename would instead make
  2497.      this call return the size of files found with those functions, as they
  2498.      use the same buffer.
  2499.  
  2500.      ■  Return Value
  2501.  
  2502.      An integer value representing the size of the indicated file is re-
  2503.      turned, or a value of -1 is returned if the indicated file could not
  2504.      be found.
  2505.  
  2506.      ■  See Also
  2507.  
  2508.      filefind, filetime, fileattr
  2509.  
  2510.      ■  Example
  2511.  
  2512.      str filespec[24] = "*.*", buf[12];
  2513.      int size;
  2514.      siz = filesize("TELIX.EXE");   // get size of file TELIX.EXE
  2515.      // Add up size of all files int he current directory
  2516.      siz = 0;
  2517.      while (filefind(filespec, 0, buf) != 0)   // until no more files
  2518.       {
  2519.        siz = siz + filesize("");   // get size of last filefound file
  2520.        filespec = "";              // make sure filespec is "" on sub-
  2521.                                    // sequent calls to filefind to
  2522.                                    // continue searching for files
  2523.       }
  2524.  
  2525.  
  2526.      FILETIME
  2527.      ──────────────────────────────────────────────────────────────────────
  2528.  
  2529.      ■  Summary
  2530.  
  2531.      filetime(str <filespec>);
  2532.      Telix v3.21 - SALT Programming                Built-in Functions    44
  2533.  
  2534.  
  2535.  
  2536.      ■  Description
  2537.  
  2538.      The filetime function returns the date/time of the specified file.
  2539.      <filespec> is the name of the file and may include a drive and di-
  2540.      rectory portion, as well as the DOS wildcard characters * and ?.
  2541.  
  2542.      The values returned represents the file's modification date as the
  2543.      number of seconds since Jan 1, 1970. A date/time in this form can be
  2544.      used by the date, time, tyear, tmonth, tday, thour, tmin, tsec, and
  2545.      other functions.
  2546.  
  2547.      If <filespec> is blank (""), then the date/time of the last file found
  2548.      with the filefind function is returned. Note that calling filesize or
  2549.      fileattr in the meantime with a non-blank filename would instead make
  2550.      this call return the time/date of files found with those functions, as
  2551.      they use the same buffer.
  2552.  
  2553.      ■  Return Value
  2554.  
  2555.      An integer value representing the date/time of the indicated file is
  2556.      returned, or a value of -1 is returned if the indicated file could not
  2557.      be found.
  2558.  
  2559.      ■  See Also
  2560.  
  2561.      filefind, filesize, fileattr
  2562.  
  2563.      ■  Example
  2564.  
  2565.      int time;
  2566.      str s[16];
  2567.  
  2568.      time = filetime("TELIX.EXE");
  2569.      if (time == -1)
  2570.       prints("'TELIX.EXE" could not be found!");
  2571.      else
  2572.       {
  2573.        printsc("TELIX.EXE was created at ");
  2574.        time(time, s);
  2575.        printsc(s);
  2576.        printsc(" on ");
  2577.        date(time, s);
  2578.        printsc(s);
  2579.       }
  2580.  
  2581.      // this example assumes both files exist
  2582.      if (filetime("FILE1") < filetime("FILE2"))
  2583.       prints("FILE1 is older than FILE2");
  2584.      else
  2585.       prints("FILE1 is newer than FILE2");
  2586.      Telix v3.21 - SALT Programming                Built-in Functions    45
  2587.  
  2588.  
  2589.  
  2590.      FLUSHBUF
  2591.      ──────────────────────────────────────────────────────────────────────
  2592.  
  2593.      ■  Summary
  2594.  
  2595.      flushbuf();
  2596.  
  2597.      ■  Description
  2598.  
  2599.      The flushbuf function flushes (throws away) any characters that may be
  2600.      waiting in Telix's remote input buffer. One use for this command is to
  2601.      get rid of unwanted line noise.
  2602.  
  2603.      ■  Return Value
  2604.  
  2605.      None.
  2606.  
  2607.  
  2608.      FNSTRIP
  2609.      ──────────────────────────────────────────────────────────────────────
  2610.  
  2611.      ■  Summary
  2612.  
  2613.      fnstrip(str <filename>, int <specifier>, str <target>);
  2614.  
  2615.      ■  Description
  2616.  
  2617.      The fnstrip function allows specific parts of a filename to be ex-
  2618.      tracted. In the MS-DOS operating system, a filename can consist of up
  2619.      to four parts, the drive, the path, the name, and the extension (e.g.,
  2620.      C:\TELIX\TELIX.FON). fnstrip processes the filename specified in
  2621.      <filename>, and depending on the value of <specifier>, places any com-
  2622.      bination of these four parts in the <target> string. Legal values for
  2623.      <specifier> and their results are as follows:
  2624.  
  2625.           <specifier>    Filename portion copied
  2626.  
  2627.                0         Full file name
  2628.                1         All except the drive
  2629.                2         Drive, name, and extension
  2630.                3         Name and extension
  2631.                4         Drive, path, and name (no extension)
  2632.                5         Path and name (no extension)
  2633.                6         Drive and name (no extension)
  2634.                7         Name only (no extension)
  2635.                12        Drive and path only
  2636.                13        Path only
  2637.                14        Drive only
  2638.  
  2639.      ■  Return Value
  2640.  
  2641.      None.
  2642.  
  2643.      ■  See Also
  2644.  
  2645.      filefind
  2646.      Telix v3.21 - SALT Programming                Built-in Functions    46
  2647.  
  2648.  
  2649.  
  2650.      ■  Example
  2651.  
  2652.      str filename[64], shortname[16];
  2653.      gets(filename, 64);                 // ask for a filename
  2654.      fnstrip(filename, 3, shortname);    // keep only name & extension
  2655.  
  2656.  
  2657.      FOPEN
  2658.      ──────────────────────────────────────────────────────────────────────
  2659.  
  2660.      ■  Summary
  2661.  
  2662.      fopen(str <name>, str <mode>);
  2663.  
  2664.      ■  Description
  2665.  
  2666.      The fopen function is used to open a disk file for reading and/or
  2667.      writing. The file to be opened is given by <name>. <mode> is a string
  2668.      indicating for what use the file should be opened. Legal values for
  2669.      mode are:
  2670.  
  2671.           "r"       Opens for reading
  2672.           "w"       Opens for writing (truncates any existing file with the
  2673.                     same name)
  2674.           "a"       Opens for appending (writing at the end of the file).
  2675.                     Creates the file if it doesn't exist.
  2676.           "r+"      Opens for reading and writing. Initial position at the
  2677.                     beginning of the file (the file must already exist).
  2678.           "w+"      Opens for reading and writing. If the file exists its
  2679.                     contents are destroyed.
  2680.           "a+"      Opens for reading and appending. Creates the file if it
  2681.                     doesn't exist.
  2682.  
  2683.      If a file is opened for both reading and writing (when "r+", "w+", or
  2684.      "a+" are used as the mode), an fseek operation is necessary before
  2685.      switching from one to the other.
  2686.  
  2687.      ■  Return Value
  2688.  
  2689.      The fopen function returns a 'handle' which is an integer number by
  2690.      which this file is to be referred to until it is finally closed. A
  2691.      value of 0 is returned if the file can not be opened (because it
  2692.      doesn't exist, because a disk error occurred, or because there are no
  2693.      more file handles available). Only up to 8 files may be opened at a
  2694.      time. It is therefore very important to close open files if they are
  2695.      no longer needed and when a script is done, or else all available file
  2696.      handles will become used up.
  2697.  
  2698.      ■  See Also
  2699.  
  2700.      fclose
  2701.  
  2702.      ■  Example
  2703.  
  2704.      int f;
  2705.      f = fopen("data.txt", "r");    // open the file for reading
  2706.      if (f == 0)
  2707.      Telix v3.21 - SALT Programming                Built-in Functions    47
  2708.  
  2709.  
  2710.  
  2711.       prints("Error opening file!");
  2712.  
  2713.  
  2714.      FPUTC
  2715.      ──────────────────────────────────────────────────────────────────────
  2716.  
  2717.      ■  Summary
  2718.  
  2719.      fputc(int <c>, int <fh>);
  2720.  
  2721.      ■  Description
  2722.  
  2723.      The fputc function writes a character to the file indicated by the
  2724.      file handle <fh>. <c> is the character to write.
  2725.  
  2726.      ■  Return Value
  2727.  
  2728.      The character written is returned, unless there is an error, in which
  2729.      case a value of -1 is returned.
  2730.  
  2731.      ■  See Also
  2732.  
  2733.      fputs, fgetc
  2734.  
  2735.      ■  Example
  2736.  
  2737.      int f, i;
  2738.      str teststr[] = "This is a test string";
  2739.      f = fopen("test.dat", "w");
  2740.      for (i = 0; i < 21; ++i)           // write out string to file
  2741.       fputc(subchr(teststr, i), f);     // character by character
  2742.  
  2743.  
  2744.      FPUTS
  2745.      ──────────────────────────────────────────────────────────────────────
  2746.  
  2747.      ■  Summary
  2748.  
  2749.      fputs(str <s>, int <fh>);
  2750.  
  2751.      ■  Description
  2752.  
  2753.      The fputs function writes a string to the file represented by file
  2754.      handle <fh>. The string must be 512 bytes in length or less (all
  2755.      strings end in a zero (0) value, the use of which is usually trans-
  2756.      parent; characters are written until this 0 is encountered. The 0 is
  2757.      not written).
  2758.  
  2759.      ■  Return Value
  2760.  
  2761.      A 0 value is returned if the write is successful, a non-zero value if
  2762.      it is not.
  2763.  
  2764.      ■  See Also
  2765.  
  2766.      fputc, fgets
  2767.      Telix v3.21 - SALT Programming                Built-in Functions    48
  2768.  
  2769.  
  2770.  
  2771.      ■  Example
  2772.  
  2773.      int f, i;
  2774.      f = fopen("test.dat", "w");
  2775.      for (i = 0; i < 100; ++i)      // write out "Hello" and a new-
  2776.       fputs("Hello^M^J", f);        // line one hundred times
  2777.  
  2778.  
  2779.      FREAD
  2780.      ──────────────────────────────────────────────────────────────────────
  2781.  
  2782.      ■  Summary
  2783.  
  2784.      fread(str <buf>, int <count>, int <fh>);
  2785.  
  2786.      ■  Description
  2787.  
  2788.      The fread function reads up to <count> bytes from the file represented
  2789.      by file handle <fh>. Characters are written to the <buf> variable,
  2790.      which must be large enough.
  2791.  
  2792.      ■  Return Value
  2793.  
  2794.      The number of bytes actually read is returned, which may be less than
  2795.      <count> if an error occurs or and end-of-file is encountered.
  2796.  
  2797.      The ferror and feof functions should be used to distinguish an error
  2798.      from an end-of-file condition.
  2799.  
  2800.      ■  See Also
  2801.  
  2802.      fwrite
  2803.  
  2804.      ■  Example
  2805.  
  2806.      int f;
  2807.      str buffer[40];
  2808.      f = fopen("test.dat", "r");
  2809.      fseek(f, 1000, 0);       // goto offset 1000 in file
  2810.      fread(buffer, 40, f);    // and read 40 bytes of data
  2811.  
  2812.  
  2813.      FRENAME
  2814.      ──────────────────────────────────────────────────────────────────────
  2815.  
  2816.      ■  Summary
  2817.  
  2818.      frename(str <oldname>, str <newname>);
  2819.  
  2820.      ■  Description
  2821.  
  2822.      The frename function is used to rename a disk file. <oldname> is the
  2823.      original name of the file, while <newname> is what it should be re-
  2824.      named to. A full drive and path may be included in the original name,
  2825.      but should not be placed before the new name. The renamed file will
  2826.      stay in the original drive and directory. Case is not significant.
  2827.      Telix v3.21 - SALT Programming                Built-in Functions    49
  2828.  
  2829.  
  2830.  
  2831.      ■  Return Value
  2832.  
  2833.      If successful, frename returns a 0 value, otherwise a non-zero value
  2834.      is returned.
  2835.  
  2836.      ■  See Also
  2837.  
  2838.      fdelete
  2839.  
  2840.      ■  Example
  2841.  
  2842.      frename("\TELIX\TELIX.CAP", "OLDTLX.CAP");
  2843.  
  2844.  
  2845.      FSEEK
  2846.      ──────────────────────────────────────────────────────────────────────
  2847.  
  2848.      ■  Summary
  2849.  
  2850.      fseek(int <fh>, int <offset>, int <origin>);
  2851.  
  2852.      ■  Description
  2853.  
  2854.      The fseek function sets the position of the file pointer in the file
  2855.      represented by the file handle <fh>. The file position is where the
  2856.      next read or write will take place. <offset> is the signed offset from
  2857.      the location specified by <origin>. Legal values for <origin> are:
  2858.  
  2859.           0:   Beginning of file.
  2860.           1:   Current position.
  2861.           2:   End of file.
  2862.  
  2863.      The pointer can be positioned anywhere in the file, and even past the
  2864.      end of the file (which will extend it). It is illegal to try to posi-
  2865.      tion the pointer before the beginning of the file however.
  2866.  
  2867.      ■  Return Value
  2868.  
  2869.      If successful, fseek returns a 0 value, otherwise a non-zero value is
  2870.      returned.
  2871.  
  2872.      ■  See Also
  2873.  
  2874.      ftell
  2875.  
  2876.      ■  Example
  2877.  
  2878.      int f;
  2879.      f = fopen("test.dat", "r");
  2880.      fseek(f, 0, 0);       // go to offset 0 in file
  2881.      fseek(f, 1000, 0);    // go to offset 1000 in file
  2882.      fseek(f, -5, 1);      // go back 5 places in file
  2883.      fseek(f, 0, 2);       // go to the end of the file
  2884.      Telix v3.21 - SALT Programming                Built-in Functions    50
  2885.  
  2886.  
  2887.  
  2888.      FTELL
  2889.      ──────────────────────────────────────────────────────────────────────
  2890.  
  2891.      ■  Summary
  2892.  
  2893.      ftell(int <fh>);
  2894.  
  2895.      ■  Description
  2896.  
  2897.      The ftell function returns the current file position in the file rep-
  2898.      resented by file handle <fh>. This is generally the position where the
  2899.      next read or write operation will take place. Note however that for a
  2900.      file opened in Append mode, the value returned will not necessarily
  2901.      return the position of the next write, since Append mode will force
  2902.      writes to the end of file regardless of the current file position.
  2903.  
  2904.      ■  Return Value
  2905.  
  2906.      An integer value as described above. A -1 value is returned if an er-
  2907.      ror occurs.
  2908.  
  2909.      ■  See Also
  2910.  
  2911.      fseek
  2912.  
  2913.  
  2914.      FWRITE
  2915.      ──────────────────────────────────────────────────────────────────────
  2916.  
  2917.      ■  Summary
  2918.  
  2919.      fwrite(str <buf>, int <count>, int <fh>);
  2920.  
  2921.      ■  Description
  2922.  
  2923.      The fwrite function writes bytes to the file represented by the file
  2924.      handle <fh>. <count> number of bytes are written from <buf>.
  2925.  
  2926.      ■  Return Value
  2927.  
  2928.      The number of bytes actually written are returned, which may be less
  2929.      than <count> if an error occurred.
  2930.  
  2931.      ■  See Also
  2932.  
  2933.      fread
  2934.  
  2935.      ■  Example
  2936.  
  2937.      int f;
  2938.      str buffer[] = "1234567890123456789012345";
  2939.      f = fopen("test.dat", "w");
  2940.      fwrite(buffer, 25, f);       // write test pattern to file
  2941.      Telix v3.21 - SALT Programming                Built-in Functions    51
  2942.  
  2943.  
  2944.  
  2945.      GET_BAUD
  2946.      ──────────────────────────────────────────────────────────────────────
  2947.  
  2948.      ■  Summary
  2949.  
  2950.      get_baud();
  2951.  
  2952.      ■  Description
  2953.  
  2954.      The get_baud function returns an integer value which is the current
  2955.      baud rate in use on the current communications port (300 through
  2956.      115200).
  2957.  
  2958.      ■  Return Value
  2959.  
  2960.      As described above.
  2961.  
  2962.      ■  See Also
  2963.  
  2964.      get_parity, get_datab, get_stopb, get_port
  2965.  
  2966.      ■  Example
  2967.  
  2968.      prints("The current baud rate is ");
  2969.      printn(get_baud());
  2970.      prints("");
  2971.  
  2972.  
  2973.      GET_DATAB
  2974.      ──────────────────────────────────────────────────────────────────────
  2975.  
  2976.      ■  Summary
  2977.  
  2978.      get_datab();
  2979.  
  2980.      ■  Description
  2981.  
  2982.      The get_datab function returns the data bits setting in use on the
  2983.      current communications port (7 or 8).
  2984.  
  2985.      ■  Return Value
  2986.  
  2987.      As described above.
  2988.  
  2989.      ■  See Also
  2990.  
  2991.      get_baud, get_parity, get_stopb, get_port
  2992.  
  2993.  
  2994.      GETENV
  2995.      ──────────────────────────────────────────────────────────────────────
  2996.  
  2997.      ■  Summary
  2998.  
  2999.      getenv(str <varname>, str <target>);
  3000.      Telix v3.21 - SALT Programming                Built-in Functions    52
  3001.  
  3002.  
  3003.  
  3004.      ■  Description
  3005.  
  3006.      The getenv function may be used to access the DOS Environment and get
  3007.      the value assigned to an Environment Variable. <varname> is the name
  3008.      of the environment variable to be searched for, and <target>  is the
  3009.      string variable where whatever is assigned to the environment variable
  3010.      should be placed.
  3011.  
  3012.      ■  Return Value
  3013.  
  3014.      A non-zero (TRUE) value is returned if the function is successful,
  3015.      otherwise a zero (FALSE) values is returned (if the environment vari-
  3016.      able didn't exist);
  3017.  
  3018.      ■  Example
  3019.  
  3020.      // Get and print whatever is assigned to the TELIX env. variable
  3021.      str value[64];
  3022.      if (getenv("TELIX", value))    // if env. variable exists
  3023.       prints(value);                // print value
  3024.  
  3025.  
  3026.      GET_PARITY
  3027.      ──────────────────────────────────────────────────────────────────────
  3028.  
  3029.      ■  Summary
  3030.  
  3031.      get_parity();
  3032.  
  3033.      ■  Description
  3034.  
  3035.      The get_parity function returns an integer value which represents the
  3036.      current parity setting in use on the current comm port.
  3037.  
  3038.      ■  Return Value
  3039.  
  3040.      Returned values are as follows:
  3041.  
  3042.                0    No parity
  3043.                1    Even parity
  3044.                2    Odd parity
  3045.  
  3046.      ■  See Also
  3047.  
  3048.      get_baud, get_datab, get_stopb, get_port
  3049.  
  3050.  
  3051.      GET_PORT
  3052.      ──────────────────────────────────────────────────────────────────────
  3053.  
  3054.      ■  Summary
  3055.  
  3056.      get_port();
  3057.      Telix v3.21 - SALT Programming                Built-in Functions    53
  3058.  
  3059.  
  3060.  
  3061.      ■  Description
  3062.  
  3063.      The get_port function returns the number (1 through 8) of the current
  3064.      communications port being used.
  3065.  
  3066.      ■  Return Value
  3067.  
  3068.      As described above.
  3069.  
  3070.      ■  See Also
  3071.  
  3072.      get_baud, get_datab, get_parity, get_stopb
  3073.  
  3074.      ■  Example
  3075.  
  3076.      prints("Currently using COM");
  3077.      printn(get_port());
  3078.      prints("");
  3079.  
  3080.  
  3081.      GET_STOPB
  3082.      ──────────────────────────────────────────────────────────────────────
  3083.  
  3084.      ■  Summary
  3085.  
  3086.      get_stopb();
  3087.  
  3088.      ■  Description
  3089.  
  3090.      The get_stopb function returns the stop bits setting in use on the
  3091.      current com port (1 or 2).
  3092.  
  3093.      ■  Return Value
  3094.  
  3095.       As described above.
  3096.  
  3097.      ■  See Also
  3098.  
  3099.      get_baud, get_datab, get_parity, get_port
  3100.  
  3101.  
  3102.      GETS
  3103.      ──────────────────────────────────────────────────────────────────────
  3104.  
  3105.      ■  Summary
  3106.  
  3107.      gets(str <buffer>, int <max>);
  3108.  
  3109.      ■  Description
  3110.  
  3111.      The gets function allows the user to enter a complete string, and use
  3112.      the arrow keys to edit it while it is being entered. <buffer> is the
  3113.      string variable where the string should be put, while <max> is the
  3114.      maximum number of characters the user may enter (from 0 to 80). The
  3115.      user may edit the string as it is being entered, with the Left-Arrow,
  3116.      Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it is being
  3117.      entered, and insert mode may be toggled on/off with the INS key.
  3118.      Telix v3.21 - SALT Programming                Built-in Functions    54
  3119.  
  3120.  
  3121.  
  3122.      String entry is over when the user presses Enter (Carriage Return on
  3123.      some computers). The user may press Esc to abort string entry, in
  3124.      which case the resulting string will have a length of 0.
  3125.  
  3126.      ■  Return Value
  3127.  
  3128.      The number of characters entered by the user are returned. If the user
  3129.      pressed Esc to abort string entry, a value of -1 is returned.
  3130.  
  3131.      ■  See Also
  3132.  
  3133.      getsxy
  3134.  
  3135.      ■  Example
  3136.  
  3137.      int n;
  3138.      str password[8];
  3139.      printsc("Enter a password? ");
  3140.      n = gets(password, 8);
  3141.  
  3142.      GETSXY
  3143.      ──────────────────────────────────────────────────────────────────────
  3144.  
  3145.      ■  Summary
  3146.  
  3147.      getsxy(str <targets>, int <max>, int <x>, int <y>, int <color>);
  3148.  
  3149.      ■  Description
  3150.  
  3151.      The getsxy function is similar to the gets function, but the x,y lo-
  3152.      cation of string entry may be specified, as well as a color attribute.
  3153.      <buffer> is the string variable where the string should be put, while
  3154.      <max> is the maximum number of characters the user may enter (from 0
  3155.      to 80). The cursor will be moved to <x>,<y>, and text entered will use
  3156.      a color as described by <color>.
  3157.  
  3158.      The user may edit the string as it is being entered, with the Left-Ar-
  3159.      row, Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it is
  3160.      being entered, and insert mode may be toggled on/off with the INS key.
  3161.      String entry is over when the user presses Enter (Carriage Return on
  3162.      some computers). The user may press Esc to abort string entry, in
  3163.      which case the resulting string will have a length of 0.
  3164.  
  3165.      ■  Return Value
  3166.  
  3167.      The number of characters entered by the user are returned. If the user
  3168.      pressed Esc to abort string entry, a value of -1 is returned.
  3169.  
  3170.      ■  See Also
  3171.  
  3172.      gets
  3173.  
  3174.      ■  Example
  3175.  
  3176.      int n;
  3177.      str filename[64] = "C:\TELIX\TELIX.EXE";
  3178.        // allow use to enter filename in black on white
  3179.      Telix v3.21 - SALT Programming                Built-in Functions    55
  3180.  
  3181.  
  3182.  
  3183.        // at current cursor position
  3184.      n = getsxy(filename, 64, getx(), gety(), 112);
  3185.  
  3186.  
  3187.      GETX, GETY
  3188.      ──────────────────────────────────────────────────────────────────────
  3189.  
  3190.      ■  Summary
  3191.  
  3192.      getx();
  3193.  
  3194.      gety();
  3195.  
  3196.      ■  Description
  3197.  
  3198.      The getx function returns the current column (horizontal x axis) po-
  3199.      sition of the cursor on the screen.
  3200.  
  3201.      The gety function returns the current row (vertical y axis) position
  3202.      of the cursor on the screen.
  3203.  
  3204.      ■  Return Value
  3205.  
  3206.      Returned values will range from 0 for the leftmost column to 79 for
  3207.      the rightmost column, for the getx function.
  3208.  
  3209.      Returned values range from 0 for the upper edge of the screen to 24
  3210.      for the lower edge, for the gety functions..
  3211.  
  3212.      ■  See Also
  3213.  
  3214.      gotoxy
  3215.  
  3216.  
  3217.      GOTOXY
  3218.      ──────────────────────────────────────────────────────────────────────
  3219.  
  3220.      ■  Summary
  3221.  
  3222.      gotoxy(int <xpos>, int <ypos>);
  3223.  
  3224.      ■  Description
  3225.  
  3226.      The gotoxy function positions the cursor at the screen coordinates
  3227.      given by <xpos> and <ypos>. Note that 0,0 is the upper left corner. On
  3228.      a 80x25 text screen, the lower right corner would be 79,24.
  3229.  
  3230.      ■  Return Value
  3231.  
  3232.      None.
  3233.  
  3234.      ■  See Also
  3235.  
  3236.      getx, gety
  3237.      Telix v3.21 - SALT Programming                Built-in Functions    56
  3238.  
  3239.  
  3240.  
  3241.      ■  Example
  3242.  
  3243.      gotoxy(0, 0);      // go to the top left corner
  3244.  
  3245.      gotoxy(79, 24);    // go to the bottom right corner
  3246.  
  3247.  
  3248.      HANGUP
  3249.      ──────────────────────────────────────────────────────────────────────
  3250.  
  3251.      ■  Summary
  3252.  
  3253.      hangup();
  3254.  
  3255.      ■  Description
  3256.  
  3257.      The hangup function tries to hang-up the modem, exactly as if the user
  3258.      had pressed Alt-H while in terminal mode. This is accomplished by
  3259.      first dropping (turning off) a signal called the DTR line, and if that
  3260.      is unsuccessful, sending the hang-up string defined in the configu-
  3261.      ration menu.
  3262.  
  3263.      ■  Return Value
  3264.  
  3265.      A non-zero (TRUE) value is returned if the hang-up is  successful,
  3266.      otherwise a zero (FALSE) value is returned.
  3267.  
  3268.  
  3269.      HELPSCREEN
  3270.      ──────────────────────────────────────────────────────────────────────
  3271.  
  3272.      ■  Summary
  3273.  
  3274.      helpscreen();
  3275.  
  3276.      ■  Description
  3277.  
  3278.      The helpscreen function displays the help/status screen, as if the
  3279.      user had pressed the appropriate key while in terminal mode.
  3280.  
  3281.      ■  Return Value
  3282.  
  3283.      None.
  3284.  
  3285.  
  3286.      INKEY, INKEYW
  3287.      ──────────────────────────────────────────────────────────────────────
  3288.  
  3289.      ■  Summary
  3290.  
  3291.      inkey();
  3292.  
  3293.      inkeyw();
  3294.      Telix v3.21 - SALT Programming                Built-in Functions    57
  3295.  
  3296.  
  3297.  
  3298.      ■  Description
  3299.  
  3300.      The inkey function returns a character from the keyboard, but does not
  3301.      wait for a key to be pressed.
  3302.  
  3303.      The inkeyw function returns a character from the keyboard, and waits
  3304.      for a key to be pressed if the keyboard buffer is empty.
  3305.  
  3306.      Note that Telix while executing a script file checks the keyboard be-
  3307.      tween every command to see if the user wants to abort the script. For
  3308.      these commands to work, this keyboard checking must be disabled. This
  3309.      is done by setting the _scr_chk_key system variable to a non-zero
  3310.      (FALSE) value (that variable is further described in the section on
  3311.      system variables).
  3312.  
  3313.      ■  Return Value
  3314.  
  3315.      inkey returns the first character in the keyboard buffer, or a value
  3316.      of 0 if the keyboard buffer is empty.
  3317.  
  3318.      inkeyw waits until a key has been pressed if none is available in the
  3319.      keyboard buffer, and returns that value.
  3320.  
  3321.      Both of these functions also return extended key code values which are
  3322.      not part of the ASCII character set (for example, the code for Alt-D).
  3323.      These values are described in the Appendix.
  3324.  
  3325.      ■  Example
  3326.  
  3327.      chr = inkey();
  3328.  
  3329.  
  3330.      INSCHRS
  3331.      ──────────────────────────────────────────────────────────────────────
  3332.  
  3333.      ■  Summary
  3334.  
  3335.      inschrs(str <source>, str <target>, int <pos>, int <num>);
  3336.  
  3337.      ■  Description
  3338.  
  3339.      The inschrs function is used to insert characters from one string into
  3340.      another at a specific position, shifting existing characters to the
  3341.      right. Characters are taken from <source> and placed in <target>, at
  3342.      an offset indicated by <pos>. Note that string offsets are numbered
  3343.      starting at 0, so the first character would have an offset of 0, the
  3344.      second 1, etc. Only <num> characters are inserted, and existing char-
  3345.      acters are shifted to the right (and are lost if they shift past the
  3346.      space allocated for the string).
  3347.  
  3348.      ■  Return Value
  3349.  
  3350.      None.
  3351.  
  3352.      ■  See Also
  3353.  
  3354.      copystr, copychrs
  3355.      Telix v3.21 - SALT Programming                Built-in Functions    58
  3356.  
  3357.  
  3358.  
  3359.      ■  Example
  3360.  
  3361.      str test[24] = "Good-bye";
  3362.      // add "Hello" to the front of the existing string
  3363.      inschrs("Hello ", test, 0, 6);
  3364.  
  3365.  
  3366.      ISALNUM - ISUPPER
  3367.      ──────────────────────────────────────────────────────────────────────
  3368.  
  3369.      ■  Summary
  3370.  
  3371.      isalnum(int <c>);   Test for alphanumeric ('A'-'Z', 'a'-'z', or '0'-
  3372.                               '9'
  3373.  
  3374.      isalpha(int <c>);   Test for letter ('A'-'Z' or 'a'-'z')
  3375.  
  3376.      isascii(int <c>);   Test for ASCII value (0-255)
  3377.  
  3378.      iscntrl(int <c>);   Test for Control character (0-31 or 127)
  3379.  
  3380.      isdigit(int <c>);   Test for digit ('0'-'9')
  3381.  
  3382.      islower(int <c>);   Test for lower case ('a'-'z')
  3383.  
  3384.      isupper(int <c>);   Test for upper case ('A'-'Z')
  3385.  
  3386.      ■  Description
  3387.  
  3388.      The functions listed above test an integer value and return a non-zero
  3389.      (TRUE) value if the test condition is satisfied, or a zero (FALSE) if
  3390.      it is not.
  3391.  
  3392.      Except for isascii, these functions give valid results only for in-
  3393.      teger values in the ASCII character set, that is, values for which
  3394.      isascii is true.
  3395.  
  3396.      ■  Return Value
  3397.  
  3398.      A non-zero (TRUE) value is returned if the test condition is sat-
  3399.      isfied, a 0 (FALSE) value otherwise.
  3400.  
  3401.  
  3402.      IS_LOADED
  3403.      ──────────────────────────────────────────────────────────────────────
  3404.  
  3405.      ■  Summary
  3406.  
  3407.      is_loaded(str <filename>);
  3408.  
  3409.      ■  Description
  3410.  
  3411.      The is_loaded function is used to determine if a SALT script, in-
  3412.      dicated by <filename> is currently loaded into memory. The script can
  3413.      be in memory if it was explicitly loaded with the load_script func-
  3414.      tion, or is still in memory because it previously was run and did not
  3415.      Telix v3.21 - SALT Programming                Built-in Functions    59
  3416.  
  3417.  
  3418.  
  3419.      finish executing. If filename does not include an extension, ".SLC" is
  3420.      automatically added.
  3421.  
  3422.      ■  Return Value
  3423.  
  3424.      A non-zero (TRUE) values is returned if the indicated script file is
  3425.      in memory, otherwise a zero (FALSE) value is returned.
  3426.  
  3427.      ■  See Also
  3428.  
  3429.      load_scr, unload_scr
  3430.  
  3431.      ■  Example
  3432.  
  3433.      if (!is_loaded("TESTSCR"))   // make sure script is in memory
  3434.       load_scr("TESTSCR");
  3435.  
  3436.  
  3437.      ITOS
  3438.      ──────────────────────────────────────────────────────────────────────
  3439.  
  3440.      ■  Summary
  3441.  
  3442.      itos(int <value>, str <s>);
  3443.  
  3444.      ■  Description
  3445.  
  3446.      The itos function writes out the digits of the supplied integer value
  3447.      to <s>.
  3448.  
  3449.      ■  Return Value
  3450.  
  3451.      None.
  3452.  
  3453.      ■  See Also
  3454.  
  3455.      stoi
  3456.  
  3457.      ■  Example
  3458.  
  3459.      int chr;
  3460.      str s[16];
  3461.      chr = inkeyw();       // get a user keystroke
  3462.      itos(chr, s);         // and print out ASCII value of character
  3463.      prints(s);
  3464.  
  3465.  
  3466.      KEYGET
  3467.      ──────────────────────────────────────────────────────────────────────
  3468.  
  3469.      ■  Summary
  3470.  
  3471.      keyget(int <key>, int <table>, str <buffer>);
  3472.      Telix v3.21 - SALT Programming                Built-in Functions    60
  3473.  
  3474.  
  3475.  
  3476.      ■  Description
  3477.  
  3478.      The keyget function is used to look at what text is assigned to a key.
  3479.      <key> is an integer value representing the key (as described in the
  3480.      appendix). Any macro text assigned to this key will be placed in
  3481.      <buffer>. Telix keeps two key macro definition tables in memory at all
  3482.      times, a user key table, and a terminal key table, loaded in whenever
  3483.      the current terminal is changed. If <table> is 0, the key is assumed
  3484.      to be in the user table. If <table> is 1, the key is assumed to be in
  3485.      the terminal table.
  3486.  
  3487.      ■  Return Value
  3488.  
  3489.      None.
  3490.  
  3491.      ■  See Also
  3492.  
  3493.      keyset, keyload, keysave
  3494.  
  3495.      ■  Example
  3496.  
  3497.      str s[100];
  3498.      prints("Text currently assigned to the F1 key in user table is:");
  3499.      keyget(0x3b00, 0, s);
  3500.      prints(s);
  3501.  
  3502.  
  3503.      KEYLOAD
  3504.      ──────────────────────────────────────────────────────────────────────
  3505.  
  3506.      ■  Summary
  3507.  
  3508.      keyload(str <fname>, int <table>);
  3509.  
  3510.      ■  Description
  3511.  
  3512.      The keyload function is used to load a keyboard macro definition file
  3513.      into Telix. <fname> is the name of the definition file (if no exten-
  3514.      sion is given, .KEY is assumed). Telix always keeps two definition ta-
  3515.      bles in memory, a relatively constant user table, and a terminal table
  3516.      which changes with each different terminal and holds the proper key
  3517.      assignments for that terminal. If <table> is 0, then the definitions
  3518.      are loaded into the user table. If <table> is 1, the definitions are
  3519.      loaded into the terminal table.
  3520.  
  3521.      ■  Return Value
  3522.  
  3523.      A value of -1 is returned if there are problems loading the key file,
  3524.      otherwise a non-zero (TRUE) value is returned.
  3525.  
  3526.      ■  See Also
  3527.  
  3528.      keysave, keyget, keyset
  3529.  
  3530.      ■  Example
  3531.  
  3532.      keyload("SPECIAL", 0);
  3533.      Telix v3.21 - SALT Programming                Built-in Functions    61
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.      KEYSAVE
  3540.      ──────────────────────────────────────────────────────────────────────
  3541.  
  3542.      ■  Summary
  3543.  
  3544.      keysave(str <fname>, int <table>);
  3545.  
  3546.      ■  Description
  3547.  
  3548.      The keysave function is used to save the current macro key text def-
  3549.      initions to a disk file. <fname> is the file to save the definitions
  3550.      to, and if no extension is given, ".KEY" is added. Telix always keeps
  3551.      two key definition tables in memory, a relatively constant user table,
  3552.      and a terminal table which changes with each different terminal and
  3553.      holds the proper key assignments for that terminal. If <table> is 0,
  3554.      then the definitions from the user table are saved. If <table> is 1,
  3555.      the definitions from the terminal table are saved.
  3556.  
  3557.      ■  Return Value
  3558.  
  3559.      A value of -1 is returned if there is a problem writing to the file,
  3560.      otherwise a non-zero (TRUE) value is returned.
  3561.  
  3562.      ■  See Also
  3563.  
  3564.      keyload, keyget, keyset
  3565.  
  3566.  
  3567.      KEYSET
  3568.      ──────────────────────────────────────────────────────────────────────
  3569.  
  3570.      ■  Summary
  3571.  
  3572.      keyset(int <key>, int <table>, str <text>);
  3573.  
  3574.      ■  Description
  3575.  
  3576.      The keyset function is used to assign text to a key. <key> is an in-
  3577.      teger value representing the key (as described in the appendix).
  3578.      <text> is what to assign to this key. Telix always keeps two key defi-
  3579.      nition tables in memory, a relatively constant user table, and a ter-
  3580.      minal table which changes with each different terminal and holds the
  3581.      proper key assignments for that terminal. If <table> is 0, the key
  3582.      definition in the user table is affected. If <table> is 1, the key
  3583.      definition in the terminal table is affected.
  3584.  
  3585.      ■  Return Value
  3586.  
  3587.      None.
  3588.  
  3589.      ■  See Also
  3590.  
  3591.      keyget, keyload, keysave
  3592.      Telix v3.21 - SALT Programming                Built-in Functions    62
  3593.  
  3594.  
  3595.  
  3596.      ■  Example
  3597.  
  3598.      // Assign a name to the F1 key in the user table
  3599.      // Note that if the terminal table also holds a
  3600.      // definition for that key it will take precedence
  3601.      keyset((0x3b00, 0, "Joe Smith");
  3602.  
  3603.  
  3604.      LOADFON
  3605.      ──────────────────────────────────────────────────────────────────────
  3606.  
  3607.      ■  Summary
  3608.  
  3609.      int loadfon(str <filename>);
  3610.  
  3611.      ■  Description
  3612.  
  3613.      The loadfon function loads the given dialing directory file. The com-
  3614.      plete name must be given, including any extension (e.g. .FON) or the
  3615.      disk drive/directory if the file is not in the current directory.
  3616.  
  3617.      ■  Return Value
  3618.  
  3619.      A non-zero (TRUE) value is returned if the dialing directory file is
  3620.      successfully loaded. If some sort of error occurs (file does not ex-
  3621.      ist, file reading error, etc.) a zero (FALSE) value is returned.
  3622.  
  3623.  
  3624.      LOAD_SCR
  3625.      ──────────────────────────────────────────────────────────────────────
  3626.  
  3627.      ■  Summary
  3628.  
  3629.      load_scr(str <filename>);
  3630.  
  3631.      ■  Description
  3632.  
  3633.      When a script is run (either by the user manually running it from ter-
  3634.      minal mode, or from within another script), it is usually loaded from
  3635.      disk. The load_scr function is used to load a script into memory ahead
  3636.      of time, providing a savings in time when the script must be run re-
  3637.      peatedly. <filename> is the name of the script file to load, and if no
  3638.      extension is given, ".SLC" is assumed.
  3639.  
  3640.      ■  Return Value
  3641.  
  3642.      If there is a problem loading the script file (it is not there or
  3643.      there is not enough memory),a value of -1 is returned. Otherwise a
  3644.      non-zero (TRUE) value is returned.
  3645.  
  3646.      ■  See Also
  3647.  
  3648.      unload_scr, is_loaded
  3649.  
  3650.      ■  Example
  3651.  
  3652.      int stat;
  3653.      Telix v3.21 - SALT Programming                Built-in Functions    63
  3654.  
  3655.  
  3656.  
  3657.      stat = load_scr("TEST");     // load TEST.SLC
  3658.  
  3659.  
  3660.      NEWDIR
  3661.      ──────────────────────────────────────────────────────────────────────
  3662.  
  3663.      ■  Summary
  3664.  
  3665.      newdir(str <directory>);
  3666.  
  3667.      ■  Description
  3668.  
  3669.      The newdir function is used to change the current drive and/or di-
  3670.      rectory. The <directory> argument should be the drive and/or directory
  3671.      to change to.
  3672.  
  3673.      ■  Return Value
  3674.  
  3675.      A non-zero (TRUE) value is returned if the function is successful,
  3676.      otherwise a zero (FALSE) values is returned (if the drive or directory
  3677.      is illegal or doesn't exist).
  3678.  
  3679.      ■  See Also
  3680.  
  3681.      dos, run
  3682.  
  3683.      ■  Example
  3684.  
  3685.      newdir("C:\TELIX");
  3686.  
  3687.  
  3688.      PRINTC
  3689.      ──────────────────────────────────────────────────────────────────────
  3690.  
  3691.      ■  Summary
  3692.  
  3693.      printc(int <chr>);
  3694.  
  3695.      ■  Description
  3696.  
  3697.      The printc function prints the character represented by the ASCII
  3698.      value <chr> to the terminal screen.
  3699.  
  3700.      ■  Return Value
  3701.  
  3702.      <chr> is returned.
  3703.  
  3704.      ■  See Also
  3705.  
  3706.      prints, printsc, printn
  3707.  
  3708.      ■  Example
  3709.  
  3710.      printc('A');
  3711.  
  3712.      printc(7);            // print ASCII value 7 (BELL sound)
  3713.      Telix v3.21 - SALT Programming                Built-in Functions    64
  3714.  
  3715.  
  3716.  
  3717.      printc(keyinw());     // print user keypress
  3718.  
  3719.  
  3720.      PRINTER
  3721.      ──────────────────────────────────────────────────────────────────────
  3722.  
  3723.      ■  Summary
  3724.  
  3725.      printer(int <state>);
  3726.  
  3727.      ■  Description
  3728.  
  3729.      The printer function is used within a script file to turn the printer
  3730.      on or off, as if the user had pressed the appropriate key in terminal
  3731.      mode. If <state> is a non-zero (TRUE) value, echoing to the printer is
  3732.      turned on, otherwise echoing is turned off
  3733.  
  3734.      ■  Return Value
  3735.  
  3736.      None.
  3737.  
  3738.      ■  See Also
  3739.  
  3740.      capture
  3741.  
  3742.      ■  Example
  3743.  
  3744.      printer(1);         // turn on printer log
  3745.  
  3746.  
  3747.      PRINTN
  3748.      ──────────────────────────────────────────────────────────────────────
  3749.  
  3750.      ■  Summary
  3751.  
  3752.      printn(int <num>);
  3753.  
  3754.      ■  Description
  3755.  
  3756.      The printn function prints the passed integer number to the terminal
  3757.      screen. The cursor is NOT advanced to the beginning of the next line.
  3758.  
  3759.      ■  Return Value
  3760.  
  3761.      The value of the passed integer is returned.
  3762.  
  3763.      ■  See Also
  3764.  
  3765.      prints, printsc, printc
  3766.  
  3767.      ■  Example
  3768.  
  3769.      printsc("Current baud rate is ");
  3770.      printn(get_baud);
  3771.      Telix v3.21 - SALT Programming                Built-in Functions    65
  3772.  
  3773.  
  3774.  
  3775.      PRINTS, PRINTSC, PRINTSC_TRM
  3776.      ──────────────────────────────────────────────────────────────────────
  3777.  
  3778.      ■  Summary
  3779.  
  3780.      prints(str <outstr>);
  3781.  
  3782.      printsc(str <outstr>);
  3783.  
  3784.      printsc_trm(str <outstr>);
  3785.  
  3786.      ■  Description
  3787.  
  3788.      The prints function prints the passed string at the current cursor po-
  3789.      sition on the screen, followed by a Carriage Return and Line Feed
  3790.      (which places the cursor at the beginning of the next line).
  3791.  
  3792.      The printsc function prints the passed string at the current cursor
  3793.      position on the screen. The cursor is not advanced to the next line,
  3794.      hence the 'c', which stands for continuous.
  3795.  
  3796.      The printsc_trm function is similar to the above, except that out-
  3797.      putted characters pass through the current terminal emulator, so ter-
  3798.      minal escape sequences may be included in output strings.
  3799.  
  3800.      ■  Return Value
  3801.  
  3802.      None.
  3803.  
  3804.      ■  See Also
  3805.  
  3806.      printn, printc
  3807.  
  3808.      ■  Example
  3809.  
  3810.      prints("Hello");
  3811.  
  3812.      printsc("Hello^M^J");    // same effect as above
  3813.  
  3814.      printsc_trm("^[[H");     // go to top left corner in VT102 emulation
  3815.  
  3816.  
  3817.      PSTRA, PSTRAXY
  3818.      ──────────────────────────────────────────────────────────────────────
  3819.  
  3820.      ■  Summary
  3821.  
  3822.      pstra(str <s>, int <color>);
  3823.  
  3824.      pstraxy(str <s>, int <x>, int <y>, int <color>);
  3825.  
  3826.      ■  Description
  3827.  
  3828.      The pstra (Print STRing with color Attribute) function is used to
  3829.      print a string to the screen, similar to the prints/printsc functions.
  3830.      This function is much faster however, and should be used when speed is
  3831.      important. As well, it allows a color to be specified for the text.
  3832.      Telix v3.21 - SALT Programming                Built-in Functions    66
  3833.  
  3834.  
  3835.  
  3836.      <s> will be printed to the screen at the current cursor position using
  3837.      a color as specified by <color>.
  3838.  
  3839.      The pstraxy function is similar to the above, but allows you to spec-
  3840.      ify where to print the string. The string is printed at <x>,<y>, with
  3841.      0,0 being the upper left corner of the screen.
  3842.  
  3843.      Note that prints goes through a basic TTY type terminal emulator, so
  3844.      strings printed using it may contain the basic cursor control code,
  3845.      while pstra writes directly to the screen, ignoring these sequences.
  3846.  
  3847.      ■  Return Value
  3848.  
  3849.      None.
  3850.  
  3851.      ■  See Also
  3852.  
  3853.      prints, printsc
  3854.  
  3855.      ■  Example
  3856.  
  3857.      pstraxy("Enter name:", 10, 10, 112);   // print in inverse text
  3858.  
  3859.  
  3860.      RECEIVE
  3861.      ──────────────────────────────────────────────────────────────────────
  3862.  
  3863.      ■  Summary
  3864.  
  3865.      receive(int <protocol>, str <name>);
  3866.  
  3867.      ■  Description
  3868.  
  3869.      The receive function is used to receive (download) one or more files
  3870.      from another system. <protocol> is the letter used to select the ap-
  3871.      propriate protocol from the actual download menu in Telix (e.g., 'X'
  3872.      for Xmodem), as follows:
  3873.  
  3874.                'A'       ASCII
  3875.                'K'       Kermit
  3876.                'M'       Modem7
  3877.                'S'       SEAlink
  3878.                'T'       Telink
  3879.                'X'       Xmodem
  3880.                '1'       Xmodem-1k
  3881.                'G'       Xmodem-1k-g
  3882.                'Y'       Ymodem
  3883.                'E'       YmodEm-g
  3884.                'Z'       Zmodem
  3885.  
  3886.      If an external protocol is defined, <protocol> may also be the key
  3887.      used to select it. <name> is the name the file should take. For pro-
  3888.      tocols which pass the name, such as SEAlink, Zmodem, Ymodem (batch),
  3889.      and others, the name field should be an empty string, "". If a down-
  3890.      load directory has been defined in the Configuration Menu, received
  3891.      files will go there, unless the <name> string explicitly includes a
  3892.      path to another drive/directory.
  3893.      Telix v3.21 - SALT Programming                Built-in Functions    67
  3894.  
  3895.  
  3896.  
  3897.      ■  Return Value
  3898.  
  3899.      A value of -1 is returned if the transfer was aborted, except if the
  3900.      Carrier (connection) was lost, in which case a value of -2 is re-
  3901.      turned.
  3902.  
  3903.      ■  See Also
  3904.  
  3905.      send, _down_dir
  3906.  
  3907.      ■  Example
  3908.  
  3909.      int result;
  3910.  
  3911.      result = receive('X', "TEST.EXE");
  3912.      if (result < 0)
  3913.       prints("File transfer failed!");
  3914.  
  3915.  
  3916.      REDIAL
  3917.      ──────────────────────────────────────────────────────────────────────
  3918.  
  3919.      ■  Summary
  3920.  
  3921.      redial(str <dialstr>, int <maxtries>, int <no_link>);
  3922.  
  3923.      ■  Description
  3924.  
  3925.      The redial function dials the entries specified in <dialstr>. The en-
  3926.      tries should be entered in the same format as used when typing entries
  3927.      in the dialing directory. If <dialstr> is empty (""), the redial queue
  3928.      is presented to the user, as if Alt-Q was pressed while in terminal
  3929.      mode. <maxtries> is the maximum number of dialing attempts. For exam-
  3930.      ple, if the string contains one entry, and <maxtries> is equal to 5,
  3931.      Telix will attempt to dial the number 5 times. If five entries are in-
  3932.      dicated, and <maxtries> is equal to 5, each number will only be at-
  3933.      tempted once. If <maxtries> is 0, dialing will continue until a con-
  3934.      nection is established. If an entry is connected to, and has a linked
  3935.      script file attached, that script will be run, unless <no_link> is
  3936.      non-zero (TRUE).
  3937.  
  3938.      ■  Return Value
  3939.  
  3940.      If there was a connection, the redial function returns the entry num-
  3941.      ber of the of the entry which was connected to (or 1 if a manual num-
  3942.      ber was dialed). If there was no connection established, 0 is re-
  3943.      turned. If the <dialstr> has a bad format, -1 is returned.
  3944.  
  3945.      Also, when a connection is successfully established, the entry number
  3946.      of the entry connected to is placed in the system variable
  3947.      _entry_enum, while the name of the entry connected to is placed in the
  3948.      system variable _entry_name.
  3949.  
  3950.      ■  See Also
  3951.  
  3952.      dial
  3953.      _entry_enum, _entry_name
  3954.      Telix v3.21 - SALT Programming                Built-in Functions    68
  3955.  
  3956.  
  3957.  
  3958.      ■  Example
  3959.  
  3960.      int stat;
  3961.      str number_list[] = "1 4 27";
  3962.      redial("10 15", 0);
  3963.      redial("m967-1111", 5);
  3964.      stat = redial(number_list, 0);
  3965.  
  3966.  
  3967.      RUN
  3968.      ──────────────────────────────────────────────────────────────────────
  3969.  
  3970.      ■  Summary
  3971.  
  3972.      run(str <filename>, str <comline>, int <mode>);
  3973.  
  3974.      ■  Description
  3975.  
  3976.      The run function executes the indicated file. The indicated file must
  3977.      either be in the current directory, be on the DOS PATH, or must in-
  3978.      clude the full path to the file (i.e., specify the drive and/or direc-
  3979.      tory). Make sure that if you run a program that expects user input you
  3980.      are on hand to give it. The <comline> parameter is the command line
  3981.      which should be passed to the called program. The <mode> argument
  3982.      specifies several options, as follows:
  3983.  
  3984.           0    Original screen is restored when program is completed.
  3985.           1    When program is completed, the user is prompted to press a
  3986.                key and screen is restored as soon as it is pressed.
  3987.           2    Original screen is not restored when program is completed
  3988.  
  3989.      This function is similar to the dos function. Because it uses less
  3990.      memory and loads faster, it is preferable to that function unless a
  3991.      DOS Batch file has to be run, or an internal DOS command must be spec-
  3992.      ified, in which case the dos function has to be used.
  3993.  
  3994.      ■  Return Value
  3995.  
  3996.      The run function returns a -1 if the file can not be run (because it
  3997.      can not be found or there is not enough memory). Any other value is
  3998.      the value returned by the called program (usually 0), but a positive
  3999.      value may also result when the called program is aborted.
  4000.  
  4001.      ■  See Also
  4002.  
  4003.      dos, dosfunction
  4004.  
  4005.      ■  Example
  4006.  
  4007.      run("CS", "test", 1);
  4008.      Telix v3.21 - SALT Programming                Built-in Functions    69
  4009.  
  4010.  
  4011.  
  4012.      SCROLL
  4013.      ──────────────────────────────────────────────────────────────────────
  4014.  
  4015.      ■  Summary
  4016.  
  4017.      scroll(int <x>, int <y>, int <x2>, int <y2>, int <lines>, int
  4018.      <color>);
  4019.  
  4020.      ■  Description
  4021.  
  4022.      The scroll function is used to scroll or clear a region of the screen.
  4023.      The area to handle is defined by <x>,<y> as the upper left corner, and
  4024.      <x2>,<y2> as the lower right corner (the upper left corner of the
  4025.      screen is 0,0). If the <lines> parameter is a positive value, text
  4026.      within the region is scrolled up that many lines. If <lines> is a neg-
  4027.      ative value, text within the region is scrolled down that many lines.
  4028.      If <lines> is equal to 0, the entire region is cleared. Empty lines
  4029.      scrolled into the region will have a color of <color>.
  4030.  
  4031.      ■  Return Value
  4032.  
  4033.      None.
  4034.  
  4035.      ■  See Also
  4036.  
  4037.      box
  4038.  
  4039.      ■  Example
  4040.  
  4041.      scroll(0, 0, 79, 24, 10, 7);      // scroll screen up 10 lines
  4042.  
  4043.  
  4044.      SEND
  4045.      ──────────────────────────────────────────────────────────────────────
  4046.  
  4047.      ■  Summary
  4048.  
  4049.      send(int <protocol>, str <name>);
  4050.  
  4051.      ■  Description
  4052.  
  4053.      The send function is used to send (upload) one or more files to an-
  4054.      other system over the comm port. <protocol> is the letter used to se-
  4055.      lect the appropriate protocol from the actual download menu in Telix
  4056.      (e.g., 'X' for Xmodem) as follows:
  4057.      Telix v3.21 - SALT Programming                Built-in Functions    70
  4058.  
  4059.  
  4060.  
  4061.                'A'       ASCII
  4062.                'K'       Kermit
  4063.                'M'       Modem7
  4064.                'S'       SEAlink
  4065.                'T'       Telink
  4066.                'X'       Xmodem
  4067.                '1'       Xmodem-1k
  4068.                'G'       Xmodem-1k-g
  4069.                'Y'       Ymodem
  4070.                'E'       YmodEm-g
  4071.                'Z'       Zmodem
  4072.  
  4073.      If an external protocol is defined, <protocol> may also be the key
  4074.      used to select. <name> is the file(s) to send. <name> may include the
  4075.      DOS wildcard characters * and ?, in which case all matching files will
  4076.      be sent (however the protocol used must be capable of sending more
  4077.      than one file at a time, e.g., SEAlink, Zmodem, Ymodem (batch), etc.).
  4078.      If an upload directory has been defined in the Configuration Menu,
  4079.      Telix will look there for files specified to be sent, unless the
  4080.      <name> string explicitly includes a path to another drive/directory.
  4081.  
  4082.      ■  Return Value
  4083.  
  4084.      A value of -1 is returned if the transfer was aborted, except if the
  4085.      carrier (connection) was lost, in which case a value of -2 is re-
  4086.      turned.
  4087.  
  4088.      ■  See Also
  4089.  
  4090.      receive, _up_dir
  4091.  
  4092.  
  4093.      SEND_BRK
  4094.      ──────────────────────────────────────────────────────────────────────
  4095.  
  4096.      ■  Summary
  4097.  
  4098.      send_brk(int <duration>);
  4099.  
  4100.      ■  Description
  4101.  
  4102.      The send_brk function sends a sustained break signal over the modem
  4103.      port, for a period of time, specified in tenths of a second, by
  4104.      <duration>.
  4105.  
  4106.      ■  Return Value
  4107.  
  4108.      None.
  4109.  
  4110.  
  4111.      SET_CPARAMS
  4112.      ──────────────────────────────────────────────────────────────────────
  4113.  
  4114.      ■  Summary
  4115.  
  4116.      set_cparams(int <baud>, int <parity>, int <data>, int <stop>);
  4117.      Telix v3.21 - SALT Programming                Built-in Functions    71
  4118.  
  4119.  
  4120.  
  4121.      ■  Description
  4122.  
  4123.      The set_cparams function is used to set the communications parameters
  4124.      in use on the current communications port. Allowable <baud> values are
  4125.      300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200. <parity>
  4126.      is an integer number which stands for the parity to use. Allowable
  4127.      values are 0, 1, and 2, which stand for None, Even, and Odd parity,
  4128.      respectively. <data> is the data bits setting to use; allowable values
  4129.      are 7 or 8. <stop> is the stop bits setting to use; allowable values
  4130.      are 1 or 2. Note that some combinations of settings are illegal.
  4131.  
  4132.      ■  Return Value
  4133.  
  4134.      If all the settings are legal values, a non-zero (TRUE) value is re-
  4135.      turned, otherwise a value of -1 is returned.
  4136.  
  4137.      ■  See Also
  4138.  
  4139.      set_port
  4140.  
  4141.      ■  Example
  4142.  
  4143.      set_cparams(2400, 0, 8, 1);
  4144.  
  4145.      set_cparams(9600, get_parity(), get_datab(), get_stopb());
  4146.  
  4147.      SET_DEFPROT
  4148.      ──────────────────────────────────────────────────────────────────────
  4149.  
  4150.      ■  Summary
  4151.  
  4152.      set_defprot(int <protocol>);
  4153.  
  4154.      ■  Description
  4155.  
  4156.      The set_defprot function is used to set the default file transfer pro-
  4157.      tocol presented to the user when a file transfer is requested.
  4158.      <protocol> is the letter used to select the appropriate protocol at
  4159.      the file transfer menu (see the description of the receive function
  4160.      for possible options).
  4161.  
  4162.      ■  Return Value
  4163.  
  4164.      None.
  4165.  
  4166.      ■  See Also
  4167.  
  4168.      receive, send
  4169.  
  4170.      ■  Example
  4171.  
  4172.      set_defprot('Z');      // Select Zmodem as default protocol
  4173.      Telix v3.21 - SALT Programming                Built-in Functions    72
  4174.  
  4175.  
  4176.  
  4177.      SETCHR
  4178.      ──────────────────────────────────────────────────────────────────────
  4179.  
  4180.      ■  Summary
  4181.  
  4182.      setchr(str <buf>, int <pos>, int <c>);
  4183.  
  4184.      ■  Description
  4185.  
  4186.      The setchr function puts the character <c> at position <pos> in the
  4187.      string indicated by <buf>.
  4188.  
  4189.      ■  Return Value
  4190.  
  4191.      The character <c> is returned.
  4192.  
  4193.      ■  See Also
  4194.  
  4195.      setchrs, subchr
  4196.  
  4197.      ■  Example
  4198.  
  4199.      int i;
  4200.      str s[100];
  4201.      for (i = 0; i < 10; ++i)     // set first 10 characters to 'A'
  4202.       setchr(s, i, 'A');
  4203.  
  4204.  
  4205.      SETCHRS
  4206.      ──────────────────────────────────────────────────────────────────────
  4207.  
  4208.      ■  Summary
  4209.  
  4210.      setchrs(str <buf>, int <pos>, int <c>, int <count>);
  4211.  
  4212.      ■  Description
  4213.  
  4214.      The setchrs function is used to set a range of characters in a string
  4215.      to the same value. <buf> is the string in which characters will be
  4216.      set, starting at an offset indicated by <pos> (note that the first
  4217.      character in a SALT string has an offset of 0, the second, 1, and so
  4218.      on). <count> characters will be set to the value of <c>.
  4219.  
  4220.      ■  Return Value
  4221.  
  4222.      None.
  4223.  
  4224.      ■  See Also
  4225.  
  4226.      setchr, subchrs
  4227.  
  4228.      ■  Example
  4229.  
  4230.      str s[100];
  4231.      // zero out an entire string
  4232.      setchrs(s, 0, 0, strmaxlen(s));
  4233.      // set the first ten characters to 'A'
  4234.      Telix v3.21 - SALT Programming                Built-in Functions    73
  4235.  
  4236.  
  4237.  
  4238.      setchrs(s, 0, 'A', 10);
  4239.  
  4240.  
  4241.      SET_PORT
  4242.      ──────────────────────────────────────────────────────────────────────
  4243.  
  4244.      ■  Summary
  4245.  
  4246.      set_port(int <port>);
  4247.  
  4248.      ■  Description
  4249.  
  4250.      The set_port function is used to select a communications port to use.
  4251.      Allowable values for <port> are 1 through 8.
  4252.  
  4253.      ■  Return Value
  4254.  
  4255.      If the new port can be successfully initialized, a non-zero (TRUE)
  4256.      value is returned, otherwise a value of -1 is returned.
  4257.  
  4258.      ■  See Also
  4259.  
  4260.      set_cparams
  4261.  
  4262.  
  4263.      SET_TERMINAL
  4264.      ──────────────────────────────────────────────────────────────────────
  4265.  
  4266.      ■  Summary
  4267.  
  4268.      set_terminal(str <terminal_name>);
  4269.  
  4270.      ■  Description
  4271.  
  4272.      The set_terminal function is used to switch the current terminal being
  4273.      emulated. <terminal_name> is the name of the new terminal to use, as
  4274.      follows:
  4275.  
  4276.           "TTY"
  4277.           "ANSI-BBS"
  4278.           "ANSI"
  4279.           "VT102"
  4280.           "VT52"
  4281.           "AVATAR"
  4282.  
  4283.      ■  Return Value
  4284.  
  4285.      A value of -1 is returned if there is a problem switching to the in-
  4286.      dicated terminal emulator, otherwise a non-zero (TRUE) value is re-
  4287.      turned.
  4288.  
  4289.      ■  Example
  4290.  
  4291.      set_terminal("VT102");
  4292.      Telix v3.21 - SALT Programming                Built-in Functions    74
  4293.  
  4294.  
  4295.  
  4296.      SHOW_DIRECTORY
  4297.      ──────────────────────────────────────────────────────────────────────
  4298.  
  4299.      ■  Summary
  4300.  
  4301.      show_directory(str <filespec>, int <cecho>, int <carrier>);
  4302.  
  4303.      ■  Description
  4304.  
  4305.      The show_directory function displays a files directory listing to the
  4306.      screen and optionally echoes it to the comm port. The <filespec> is
  4307.      the file mask to use (e.g., "*.*"), and may also include a drive
  4308.      and/or directory, just like the DOS 'dir' command. If the <cecho>
  4309.      argument is non-zero (TRUE), the listing is also be echoed to the comm
  4310.      port. If the <carrier> argument is non-zero (TRUE) and the listing is
  4311.      being echoed to the comm port, the carrier signal is monitored in case
  4312.      the connection is lost (which aborts the display). The user is
  4313.      prompted to press a key after every screen full of data.
  4314.  
  4315.      ■  Return Value
  4316.  
  4317.      None.
  4318.  
  4319.      ■  See Also
  4320.  
  4321.      dos, dosfunction
  4322.  
  4323.      ■  Example
  4324.  
  4325.      show_directory("*.DOC", 0, 0);
  4326.  
  4327.  
  4328.      STATUS_WIND
  4329.      ──────────────────────────────────────────────────────────────────────
  4330.  
  4331.      ■  Summary
  4332.  
  4333.      status_wind(str <message>, int <duration>);
  4334.  
  4335.      ■  Description
  4336.  
  4337.      The status_wind function is used to display a status message,
  4338.      <message>, in a pop up window. <duration> is the time in tenths of
  4339.      seconds to display the window, after which it is removed, and the pre-
  4340.      vious contents of that screen area are restored.
  4341.  
  4342.      ■  Return Value
  4343.  
  4344.      None.
  4345.  
  4346.      ■  See Also
  4347.  
  4348.      box, pstra, pstraxy
  4349.  
  4350.      ■  Example
  4351.  
  4352.      status_wind("File not found!", 10);
  4353.      Telix v3.21 - SALT Programming                Built-in Functions    75
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.      STOI
  4360.      ──────────────────────────────────────────────────────────────────────
  4361.  
  4362.      ■  Summary
  4363.  
  4364.      stoi(str <s>);
  4365.  
  4366.      ■  Description
  4367.  
  4368.      The stoi function assumes that <s> is a string which contains an in-
  4369.      teger number, written out. It processes the string digit by digit and
  4370.      returns that value. For example, stoi("123") would return the integer
  4371.      value 123. Processing stops at the first non-digit character. If an
  4372.      empty or invalid string is parsed, a value of 0 is returned.
  4373.  
  4374.      ■  Return Value
  4375.  
  4376.      An integer value as described above.
  4377.  
  4378.      ■  See Also
  4379.  
  4380.      itos
  4381.  
  4382.      ■  Example
  4383.  
  4384.      str s[] = "123";
  4385.      if (stoi(s) == 123)
  4386.       prints("This will always be printed!");
  4387.  
  4388.  
  4389.      STRCAT
  4390.      ──────────────────────────────────────────────────────────────────────
  4391.  
  4392.      ■  Summary
  4393.  
  4394.      strcat(str <string1>, str <string2>);
  4395.  
  4396.      ■  Description
  4397.  
  4398.      The strcat function concatenates (adds or appends) one string to the
  4399.      other. <string2> is added to the end of <string1>. If <string1> is not
  4400.      large enough only as many characters as will fit are added.
  4401.  
  4402.      ■  Return Value
  4403.  
  4404.      None.
  4405.  
  4406.      ■  Example
  4407.  
  4408.      str s[80] = "hello";
  4409.      strcat(s, "good-bye");
  4410.      if (s == "hellogoodbye")
  4411.       prints("This will always be printed");
  4412.      Telix v3.21 - SALT Programming                Built-in Functions    76
  4413.  
  4414.  
  4415.  
  4416.      STRCHR
  4417.      ──────────────────────────────────────────────────────────────────────
  4418.  
  4419.      ■  Summary
  4420.  
  4421.      strchr(str <s>, int <pos>, int <c);
  4422.  
  4423.      ■  Description
  4424.  
  4425.      The strchr function is used to search for a character within a string.
  4426.      <s> is the string to search, and <pos> is the starting position of the
  4427.      search, and <c> is the character (ASCII value) to search for. If the
  4428.      character, its offset is returned, otherwise a value of -1 is re-
  4429.      turned. Note that the first character in a string has an offset of 0,
  4430.      not 1 as in some languages.
  4431.  
  4432.      ■  Return Value
  4433.  
  4434.      An integer value as described above.
  4435.  
  4436.      ■  Example
  4437.  
  4438.      // Count how many times a certain char occurs in a string
  4439.  
  4440.      int i, count = 0;
  4441.      str s[] = "abcabcabcabcabc";
  4442.  
  4443.      i = 0;
  4444.      do
  4445.       {
  4446.        i = strchr(s, i, 'a');
  4447.        if (i != -1)
  4448.         count = count + 1;
  4449.       }
  4450.      while (i != -1);
  4451.  
  4452.  
  4453.      STRCMPI
  4454.      ──────────────────────────────────────────────────────────────────────
  4455.  
  4456.      ■  Summary
  4457.  
  4458.      strcmpi(str <string1>, str <string2>);
  4459.  
  4460.      ■  Description
  4461.  
  4462.      The strcmpi function is used to compare two strings (in a similar man-
  4463.      ner to the ==, >, and < operators, but ignoring the case of the
  4464.      strings). The strings are compared character by character until a dif-
  4465.      ference is found or the end of either string is found, and an integer
  4466.      value is returned as follows:
  4467.      Telix v3.21 - SALT Programming                Built-in Functions    77
  4468.  
  4469.  
  4470.  
  4471.           0         <string1> is equal to <string2>
  4472.  
  4473.           < 0       <string1> is less than <string2>
  4474.  
  4475.           > 0       <string1> is greater than <string2>
  4476.  
  4477.      ■  Return Value
  4478.  
  4479.      An integer value as described above.
  4480.  
  4481.      ■  Example
  4482.  
  4483.      if (strcmpi("HeLLo", "hEllO");
  4484.       prints("This will always be printed");
  4485.  
  4486.  
  4487.      STRLEN
  4488.      ──────────────────────────────────────────────────────────────────────
  4489.  
  4490.      ■  Summary
  4491.  
  4492.      strlen(str <s>);
  4493.  
  4494.      ■  Description
  4495.  
  4496.      The strlen function returns the number of characters in the string
  4497.      <s>. Since strings are terminated with a 0 (NULL) character, this
  4498.      function really counts the number of characters before a 0 is en-
  4499.      countered.
  4500.  
  4501.      ■  Return Value
  4502.  
  4503.      An integer value representing the length of a string.
  4504.  
  4505.      ■  See Also
  4506.  
  4507.      strmaxlen
  4508.  
  4509.      ■  Example
  4510.  
  4511.      str teststr[] = "This is a test string";
  4512.      printsc("The length of 'teststr' is ");
  4513.      printn(strlen(teststr));
  4514.  
  4515.  
  4516.      STRLOWER
  4517.      ──────────────────────────────────────────────────────────────────────
  4518.  
  4519.      ■  Summary
  4520.  
  4521.      strlower(str <s>);
  4522.  
  4523.      ■  Description
  4524.  
  4525.      The strlower function processes the string <s> and changes each upper
  4526.      case character to lower case. Other characters are left unchanged.
  4527.      Telix v3.21 - SALT Programming                Built-in Functions    78
  4528.  
  4529.  
  4530.  
  4531.      ■  Return Value
  4532.  
  4533.      None.
  4534.  
  4535.      ■  See Also
  4536.  
  4537.      strupper
  4538.  
  4539.  
  4540.      STRMAXLEN
  4541.      ──────────────────────────────────────────────────────────────────────
  4542.  
  4543.      ■  Summary
  4544.  
  4545.      strmaxlen(str <s>);
  4546.  
  4547.      ■  Description
  4548.  
  4549.      The strmaxlen function returns the maximum number of characters that
  4550.      string <s> can hold. This is the same value as used when the string is
  4551.      defined elsewhere in the program (e.g. if the string was defined as
  4552.      'str hello[16];', a value of 16 would be returned). All strings are
  4553.      really one character larger than defined, as the last character is al-
  4554.      ways a terminating 0 (NULL). However, since this value can not be
  4555.      changed, it is not counted as part of the length of a string.
  4556.  
  4557.      ■  Return Value
  4558.  
  4559.      An integer value as described above.
  4560.  
  4561.      ■  See Also
  4562.  
  4563.      strlen
  4564.  
  4565.  
  4566.      STRPOS, STRPOSI
  4567.      ──────────────────────────────────────────────────────────────────────
  4568.  
  4569.      ■  Summary
  4570.  
  4571.      strpos(str <string1>, str <substr>, int <start>);
  4572.  
  4573.      strposi(str <string1>, str <substr>, int <start>);
  4574.  
  4575.      ■  Description
  4576.  
  4577.      The strpos function is used to search for one string within another.
  4578.      <string1> is scanned for <substr>, starting at the offset (position)
  4579.      indicated by <start>. If the sub-string is found, its offset is re-
  4580.      turned, otherwise a value of -1 is returned. Note that the first char-
  4581.      acter has an offset of 0, not 1 as in some languages.
  4582.  
  4583.      strposi is a case insensitive version of the above.
  4584.  
  4585.      ■  Return Value
  4586.  
  4587.      An integer value as described above.
  4588.      Telix v3.21 - SALT Programming                Built-in Functions    79
  4589.  
  4590.  
  4591.  
  4592.      ■  Example
  4593.  
  4594.      str teststr[] = "cat dog cat dog";
  4595.      int i = 0, num = 0;
  4596.  
  4597.      while (1)           // loop as long as needed
  4598.       {
  4599.        i = strpos(teststr, "cat", i);
  4600.        if (i == -1)
  4601.         break;
  4602.        i = i + 1;        // make sure we don't find the same one
  4603.        num = num + 1;    // increment count
  4604.       }
  4605.  
  4606.      prints("'cat' was found ");
  4607.      printn(num);
  4608.      prints(" times.");
  4609.  
  4610.  
  4611.      STRUPPER
  4612.      ──────────────────────────────────────────────────────────────────────
  4613.  
  4614.      ■  Summary
  4615.  
  4616.      strupper(str <s>);
  4617.  
  4618.      ■  Description
  4619.  
  4620.      The strupper function processes the string <s> and changes each lower
  4621.      case character to upper case. Other characters are left unchanged.
  4622.  
  4623.      ■  Return Value
  4624.  
  4625.      None.
  4626.  
  4627.      ■  See Also
  4628.  
  4629.      strlower
  4630.  
  4631.  
  4632.      SUBCHR
  4633.      ──────────────────────────────────────────────────────────────────────
  4634.  
  4635.      ■  Summary
  4636.  
  4637.      subchr(str <s>, int <pos>);
  4638.  
  4639.      ■  Description
  4640.  
  4641.      The subchr function returns the character found at position <pos> in
  4642.      string <s>. Note that an integer (representing the ASCII value of the
  4643.      character) is returned, not a string. <pos> may be anywhere within the
  4644.      string length as defined. Note that positions start from 0. The 1st
  4645.      character in a string is at position 0, the 40th at position 39, etc.
  4646.      A string defined with a length of 10 would have valid positions of 0
  4647.      to 9, with position 10 always returning the 0 value that terminates
  4648.      all strings.
  4649.      Telix v3.21 - SALT Programming                Built-in Functions    80
  4650.  
  4651.  
  4652.  
  4653.      ■  Return Value
  4654.  
  4655.      An integer value as described above.
  4656.  
  4657.      ■  See Also
  4658.  
  4659.      setchr, subchrs
  4660.  
  4661.      ■  Example
  4662.  
  4663.      // This will print out the contents of a test string, extracting
  4664.      // each character individually, and stopping when a 0 is reached
  4665.      // which marks the end of all proper strings
  4666.  
  4667.      int i;
  4668.      str s[] = "This is a test string";
  4669.      for (i = 0; subchr(s, i) != 0; ++i)
  4670.       printc(subchr(s, i));
  4671.  
  4672.  
  4673.      SUBCHRS
  4674.      ──────────────────────────────────────────────────────────────────────
  4675.  
  4676.      ■  Summary
  4677.  
  4678.      subchrs(str <source>, int <pos>, int <count>, str <target>);
  4679.  
  4680.      ■  Description
  4681.  
  4682.      The subchrs function copies a number of characters from one string
  4683.      into another, Characters from position <pos> in <source> are copied
  4684.      into string <target> (note that SALT string offsets start at 0, not 1
  4685.      as in some languages). <count> characters are copied. Only as many
  4686.      characters as will fit in <target> are copied.
  4687.  
  4688.      This function is very similar to substr, except that it is not string
  4689.      oriented, and does not stop copying characters when a 0 value is en-
  4690.      countered.
  4691.  
  4692.      ■  Return Value
  4693.  
  4694.      None.
  4695.  
  4696.      ■  See Also
  4697.  
  4698.      substr, subchr, copystr, copychrs
  4699.  
  4700.  
  4701.      SUBSTR
  4702.      ──────────────────────────────────────────────────────────────────────
  4703.  
  4704.      ■  Summary
  4705.  
  4706.      substr(str <source>, int <pos>, int <max>, str <target>);
  4707.      Telix v3.21 - SALT Programming                Built-in Functions    81
  4708.  
  4709.  
  4710.  
  4711.      ■  Description
  4712.  
  4713.      The substr function copies a portion of one string to another. Char-
  4714.      acters from position <pos> in string <source> are copied until into
  4715.      string <target> (note that SALT string offsets start at 0, not 1 as in
  4716.      some languages). Characters are copied until a 0 (NULL) value is en-
  4717.      countered (normally at the end of every string), or <max> characters
  4718.      are copied. A 0 (NULL) is always copied at the end of the target
  4719.      string. The 0 does not count as part of the <max>. Only as many char-
  4720.      acters as will fit in <target> are copied.
  4721.  
  4722.      ■  Return Value
  4723.  
  4724.      None.
  4725.  
  4726.      ■  See Also
  4727.  
  4728.      subchrs, copystr, copychrs
  4729.  
  4730.      ■  Example
  4731.  
  4732.      str s[] = "horse cat dog", s2[16];
  4733.      substr(s, 6, 3, s2);
  4734.      if (s2 == "cat")
  4735.       prints("This will always be printed");
  4736.  
  4737.  
  4738.      TDAY - TYEAR
  4739.      ──────────────────────────────────────────────────────────────────────
  4740.  
  4741.      ■  Summary
  4742.  
  4743.      tday(int <timeval>);
  4744.  
  4745.      thour(int <timeval>);
  4746.  
  4747.      tmin(int <timeval>);
  4748.  
  4749.      tmonth(int <timeval>);
  4750.  
  4751.      tsec(int <timeval>);
  4752.  
  4753.      tyear(int <timeval>);
  4754.  
  4755.      ■  Description
  4756.  
  4757.      These functions all extract time information from <timeval>, which is
  4758.      a date and/or time of day. If <timeval> represents a date, it is the
  4759.      number of seconds from Jan 1, 1970 to that date. If <timeval> repre-
  4760.      sents a time of day, it is the number of seconds from midnight to that
  4761.      time. If it is both, the two above values are simply added together.
  4762.      Among others, the curtime and filetime functions return time/date in-
  4763.      formation in this format.
  4764.  
  4765.      tday returns an integer value from 1 to 31 representing the day por-
  4766.      tion of the date stored in <timeval>.
  4767.      Telix v3.21 - SALT Programming                Built-in Functions    82
  4768.  
  4769.  
  4770.  
  4771.      thour returns an integer value from 0 to 23 representing the hour por-
  4772.      tion of the time stored in <timeval>.
  4773.  
  4774.      tmin returns an integer value from 0 to 59 representing the minutes
  4775.      portion of the time stored in <timeval>.
  4776.  
  4777.      tmonth returns an integer value from 1 to 12 representing the month
  4778.      portion of the date stored in <timeval>.
  4779.  
  4780.      tsec returns an integer value from 1 to 59 representing the seconds
  4781.      portion of the time stored in <timeval>.
  4782.  
  4783.      tyear returns an integer value from 1970 to 2019 representing the year
  4784.      portion of the date stored in <timeval>.
  4785.  
  4786.      ■  Return Value
  4787.  
  4788.      An integer value as described above.
  4789.  
  4790.      ■  See Also
  4791.  
  4792.      curtime, filetime
  4793.  
  4794.      ■  Example
  4795.  
  4796.      int t;
  4797.      t = curtime();
  4798.      printsc("This is month number ");
  4799.      printn(tmonth(t));
  4800.      printsc(" in the year ");
  4801.      printn(tyear(t));
  4802.      prints(".");
  4803.  
  4804.  
  4805.      TERMINAL
  4806.      ──────────────────────────────────────────────────────────────────────
  4807.  
  4808.      ■  Summary
  4809.  
  4810.      terminal();
  4811.  
  4812.      ■  Description
  4813.  
  4814.      The terminal function when called allows Telix to process characters
  4815.      coming in from the serial port and print them on the terminal screen,
  4816.      and process user keystrokes. If a function has nothing to do (for ex-
  4817.      ample while using the track function), it can call terminal to make
  4818.      sure characters and user keystrokes are processed. Note that if a user
  4819.      script wants to process every incoming character (e.g., with the cgetc
  4820.      function, the terminal function should never be called).
  4821.  
  4822.      ■  Return Value
  4823.  
  4824.      None.
  4825.      Telix v3.21 - SALT Programming                Built-in Functions    83
  4826.  
  4827.  
  4828.  
  4829.      ■  See Also
  4830.  
  4831.      track
  4832.  
  4833.      ■  Example
  4834.  
  4835.      // This will wait forever for either of two strings
  4836.      // to come in from the comm port, and then stop.
  4837.      int t1, t2, stat;
  4838.      t1 = track("hello", 0);
  4839.      t2 = track("good-bye", 0);
  4840.      while (1)           // loop forever
  4841.       {
  4842.        terminal();       // The call to terminal() lets any characters
  4843.                          // that come in be looked at by Telix's
  4844.                          // internal routines for a match with.
  4845.                          // Incoming chars are also printed on the
  4846.                          // terminal screen and user keystrokes are
  4847.                          // handled
  4848.        stat = track_hit(0);
  4849.        if (stat == t1 || stat == t2)   // exit if one of the strings
  4850.         break;                         // came in
  4851.       }
  4852.  
  4853.      track_free(t1);     // stop Telix for looking for more matches
  4854.      track_free(t2);
  4855.  
  4856.  
  4857.      TIME
  4858.      ──────────────────────────────────────────────────────────────────────
  4859.  
  4860.      ■  Summary
  4861.  
  4862.      time(int <timeval>, str <buffer>);
  4863.  
  4864.      ■  Description
  4865.  
  4866.      The time function writes out a time in <buffer> in the form hh:mm:ss,
  4867.      with hh being the hour in either 12 or 24 hour format based on the
  4868.      _time_format). <timeval> is the time, represented as the number of
  4869.      seconds since midnight. Time values in this form are returned by the
  4870.      curtime and filetime functions, among others.
  4871.  
  4872.      ■  Return Value
  4873.  
  4874.      None.
  4875.  
  4876.      ■  See Also
  4877.  
  4878.      date, curtime, filetime
  4879.  
  4880.      ■  Example
  4881.  
  4882.      str s[16];
  4883.      printsc("The current time is ");
  4884.      time(curtime(), s);
  4885.      prints(s);
  4886.      Telix v3.21 - SALT Programming                Built-in Functions    84
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  
  4892.      TIME_UP - TIMER_TOTAL
  4893.      ──────────────────────────────────────────────────────────────────────
  4894.  
  4895.      ■  Summary
  4896.  
  4897.      time_up(int <thandle>);
  4898.  
  4899.      timer_free(int <thandle>);
  4900.  
  4901.      timer_restart(int <thandle>, int <time>);
  4902.  
  4903.      timer_start(int <time>);
  4904.  
  4905.      timer_total(int <thandle>);
  4906.  
  4907.      ■  Description
  4908.  
  4909.      The timer functions are used to set and keep track of a timer vari-
  4910.      able.
  4911.  
  4912.      The timer_start function is used to start a timer. This timer can
  4913.      later be used to check if a certain period of time has elapsed from
  4914.      when the timer was started. This function returns an integer value
  4915.      called a timer handle, that is used to refer to this timer in the fu-
  4916.      ture. The <time> parameter is the time from the present (in tenths of
  4917.      a second) after which the timer should be considered elapsed (for use
  4918.      with the time_up function). If the time_up function will not be used,
  4919.      then this parameter can be anything.
  4920.  
  4921.      The time_up function returns a non-zero (TRUE) value if the timer rep-
  4922.      resented by timer handle <thandle> has elapsed, otherwise a 0 (FALSE)
  4923.      value is returned. The period of time after which a timer will elapse
  4924.      is specified in the timer_start function.
  4925.  
  4926.      The timer_total function returns the total time (in tenths of a sec-
  4927.      ond) since the timer represented by timer handle <thandle> was started
  4928.      or restarted.
  4929.  
  4930.      The timer_restart function performs the same things as timer_start,
  4931.      except that it restarts an existing timer, represented by timer handle
  4932.      <thandle>.
  4933.  
  4934.      The timer_free function frees a timer variable when it is no longer
  4935.      needed. <thandle> is the timer handle of the timer to free, and should
  4936.      originally have been returned by the timer_start function. After a
  4937.      timer has been freed it should no longer be referred to.
  4938.  
  4939.      ■  Return Value
  4940.  
  4941.      timer_start returns an integer number representing a 'handle' by which
  4942.      a timer will be referred to.
  4943.  
  4944.      time_up returns a non-zero (TRUE) or 0 (FALSE) value depending on
  4945.      whether a timer has elapsed or not.
  4946.      Telix v3.21 - SALT Programming                Built-in Functions    85
  4947.  
  4948.  
  4949.  
  4950.      timer_total returns an integer value representing the elapsed time
  4951.      since a timer was started.
  4952.  
  4953.      timer_restart does not return any significant value.
  4954.  
  4955.      timer_free does not return any significant value.
  4956.  
  4957.      ■  See Also
  4958.  
  4959.      delay
  4960.  
  4961.      ■  Example
  4962.  
  4963.      int t;
  4964.      t = timer_start(100);    // delay for 10 seconds
  4965.      while (!time_up(t))
  4966.       ;
  4967.      timer_free(t);
  4968.      // start a timer and loop forever, printing the elapsed time
  4969.      // in tenths of seconds
  4970.      t = timer_start(0);
  4971.      while (1)
  4972.       {
  4973.        printn(timer_total(t));
  4974.        prints("");
  4975.       }
  4976.  
  4977.  
  4978.      TOLOWER
  4979.      ──────────────────────────────────────────────────────────────────────
  4980.  
  4981.      ■  Summary
  4982.  
  4983.      tolower(int <chr>);
  4984.  
  4985.      ■  Description
  4986.  
  4987.      If the character <chr> is an uppercase character, the tolower function
  4988.      returns the lowercase equivalent. Otherwise <chr> is returned un-
  4989.      changed. Note that <chr> is an ASCII value, not a string.
  4990.  
  4991.      ■  Return Value
  4992.  
  4993.      An integer value as described above.
  4994.  
  4995.      ■  See Also
  4996.  
  4997.      toupper
  4998.  
  4999.  
  5000.      TONE
  5001.      ──────────────────────────────────────────────────────────────────────
  5002.  
  5003.      ■  Summary
  5004.  
  5005.      tone(int <frequency>, int <length>);
  5006.      Telix v3.21 - SALT Programming                Built-in Functions    86
  5007.  
  5008.  
  5009.  
  5010.      ■  Description
  5011.  
  5012.      The tone function makes Telix emit a sound of <frequency> for a period
  5013.      of time represented by length (in hundredths of a second).
  5014.  
  5015.      ■  Return Value
  5016.  
  5017.      None.
  5018.  
  5019.      ■  See Also
  5020.  
  5021.      alarm
  5022.      _sound_on
  5023.  
  5024.      ■  Example
  5025.  
  5026.      tone(659, 14);
  5027.  
  5028.  
  5029.      TOUPPER
  5030.      ──────────────────────────────────────────────────────────────────────
  5031.  
  5032.      ■  Summary
  5033.  
  5034.      tolower(int <chr>);
  5035.  
  5036.      ■  Description
  5037.  
  5038.      If the character <chr> is an lowercase character, the toupper function
  5039.      returns the uppercase equivalent. Otherwise <chr> is returned un-
  5040.      changed. Note that <chr> is an ASCII value, not a string.
  5041.  
  5042.      ■  Return Value
  5043.  
  5044.      An integer value as described above.
  5045.  
  5046.      ■  See Also
  5047.  
  5048.      tolower
  5049.  
  5050.  
  5051.      TRACK - TRACK_HIT
  5052.      ──────────────────────────────────────────────────────────────────────
  5053.  
  5054.      ■  Summary
  5055.  
  5056.      track(str <trackstr>, int <mode>);
  5057.  
  5058.      track_addchr(int <chr>);
  5059.  
  5060.      track_free(int <handle>);
  5061.  
  5062.      track_hit(int <handle>);
  5063.      Telix v3.21 - SALT Programming                Built-in Functions    87
  5064.  
  5065.  
  5066.  
  5067.      ■  Description
  5068.  
  5069.      The track and related functions are used to keep track of and wait for
  5070.      certain strings to come in over the comm port, similar in nature to
  5071.      the waitfor function. However the latter function can only wait for
  5072.      one specific string, while with the track functions can handle more
  5073.      strings at the same time (currently up to 16), and they may arrive in
  5074.      any order (or not arrive at all).
  5075.  
  5076.      The track function tells Telix to keep track of (watch for) the string
  5077.      indicated by <trackstr> to come in over the comm port. If <mode> is 0,
  5078.      case is significant, if <mode> is 1, case is not significant. The for-
  5079.      mer is faster and should be used when the many strings are being
  5080.      watched for. Track returns an integer value called a 'track handle'
  5081.      which is later used with the track_hit function to check if this
  5082.      string came in.
  5083.  
  5084.      When track is called, Telix doesn't loop endlessly waiting for the
  5085.      string to come in, but instead returns back to the script. As char-
  5086.      acters come in, Telix checks to see if any of the strings to be
  5087.      tracked have been matched, and marks those that have. A script can at
  5088.      any time call the track_hit function to see if the string represented
  5089.      by <handle> was received. If track_hit returns a non-zero (TRUE)
  5090.      value, then that string was received, otherwise it wasn't. If <handle>
  5091.      is 0, then track_hit will return the lowest numbered handle of any
  5092.      strings that came in, or 0 if none did. The marker on a handle is
  5093.      cleared once track_hit has indicated that the appropriate string was
  5094.      received.
  5095.  
  5096.      While a script is executing, Telix is not in terminal mode, and there-
  5097.      fore does not have access to incoming characters, to scan for matching
  5098.      strings. Therefore, the terminal function must periodically be called
  5099.      to allow Telix to get a look at incoming characters. This function is
  5100.      described in the appropriate place in this manual. Alternately, if a
  5101.      script must process these characters itself (with a function like
  5102.      cgetc), and therefore can not call the terminal function, they must
  5103.      still be passed by the track routines for string matching to work. The
  5104.      track_addchr function is used for this. When it is called, Telix
  5105.      treats the character represented by <chr> as if it had been received
  5106.      from the terminal handler, and uses it to scan for matching strings.
  5107.  
  5108.      The track_free function is used to tell Telix to stop tracking a cer-
  5109.      tain string. <handle> is a track handle returned by a previous call to
  5110.      the track function. It is very important that when a certain string no
  5111.      longer needs to be tracked, track_free is called, as tracking a large
  5112.      number of strings can slow down Telix execution. If <handle> is 0,
  5113.      Telix will stop tracking all strings.
  5114.  
  5115.      ■  Return Value
  5116.  
  5117.      track_addchr and track_free do not return a value. The other functions
  5118.      return integer values as described above.
  5119.  
  5120.      ■  See Also
  5121.  
  5122.      waitfor
  5123.      Telix v3.21 - SALT Programming                Built-in Functions    88
  5124.  
  5125.  
  5126.  
  5127.      ■  Example
  5128.  
  5129.      // Log-on to a BBS, answering two prompts in any order.
  5130.      // This will wait forever, so for actual use would have
  5131.      // to be changed a bit. See sample scripts for examples.
  5132.  
  5133.      int stat, t1, t2;
  5134.      t1 = track("Name? ", 0);
  5135.      t2 = track("Password? ", 0);
  5136.  
  5137.      while (1)         // loop as long as needed
  5138.       {
  5139.        terminal();     // call terminal function to allow Telix
  5140.                        // to look at incoming characters for
  5141.                        // matches and let Telix process user
  5142.                        // keystrokes
  5143.        stat = track_hit(0);       // see if any matches
  5144.        if (stat == t1)            // name prompt
  5145.          cputs("Joe Smith^M");    // send name and continue looping
  5146.        if (stat == t2)            // password prompt
  5147.         {
  5148.          cputs("mypass^M");       // send password
  5149.          break;                   //   and get out of loop
  5150.         }
  5151.       }
  5152.  
  5153.      track_free(t1);              // free track handles
  5154.      track_free(t2);
  5155.  
  5156.  
  5157.      TRANSTAB
  5158.      ──────────────────────────────────────────────────────────────────────
  5159.  
  5160.      ■  Summary
  5161.  
  5162.      transtab(str <filename>, int <table>);
  5163.  
  5164.      ■  Description
  5165.  
  5166.      The transtab function is used to load or clear the incoming or out-
  5167.      going character translation table. <table> stands for the translate
  5168.      table to manipulate, with 0 being the incoming, and 1 being the out-
  5169.      going.
  5170.  
  5171.      If <filename> is empty (""), Telix will prompt for the name of a
  5172.      translate table to load into memory.
  5173.  
  5174.      If <filename> is a valid name for a Telix translate table (saved from
  5175.      the translate table menu in Telix), it is loaded into memory.
  5176.  
  5177.      If <filename> is "*CLEAR*", the current translate table in memory is
  5178.      cleared, and Telix will no longer translate incoming characters.
  5179.  
  5180.      ■  Return Value
  5181.  
  5182.      A value of -1 is returned if there is a problem loading the indicated
  5183.      translate table, otherwise a non-zero (TRUE) value is returned.
  5184.      Telix v3.21 - SALT Programming                Built-in Functions    89
  5185.  
  5186.  
  5187.  
  5188.      ■  Example
  5189.  
  5190.      transtab("TELIX.XLT", 0);
  5191.  
  5192.  
  5193.      UNLOAD_SCR
  5194.      ──────────────────────────────────────────────────────────────────────
  5195.  
  5196.      ■  Summary
  5197.  
  5198.      unload_scr(str <filename>);
  5199.  
  5200.      ■  Description
  5201.  
  5202.      The load_scr function can be used by a script file to load another
  5203.      script into memory ahead of time (before it is run). The unload_scr
  5204.      function should then be used to unload or take out this script when it
  5205.      is no longer needed. <filename> is the name of the script file to un-
  5206.      load, and if no extension is given, ".SLC" is assumed. Note that a
  5207.      script that is currently executing or that is nested (has called the
  5208.      current script) must not be unloaded, since Telix is still executing
  5209.      it or will return to it eventually!
  5210.  
  5211.      ■  Return Value
  5212.  
  5213.      If there is a problem unloading the script file, a value of -1 is re-
  5214.      turned. Otherwise a non-zero (TRUE) value is returned.
  5215.  
  5216.      ■  See Also
  5217.  
  5218.      load_scr, is_loaded
  5219.  
  5220.      ■  Example
  5221.  
  5222.      int stat;
  5223.      stat = load_scr("TEST");     // load TEST.SLC
  5224.          ...                      // do other things
  5225.      unload_scr("TEST");          // take TEST.SLC out of memory
  5226.  
  5227.  
  5228.      UPDATE_TERM;
  5229.      ──────────────────────────────────────────────────────────────────────
  5230.  
  5231.      ■  Summary
  5232.  
  5233.      update_term();
  5234.  
  5235.      ■  Description
  5236.  
  5237.      The update_term function is called to make sure Telix updates certain
  5238.      things relating to the video and terminal page. For example, changes
  5239.      made to the _back_color and _fore_color system variables will not take
  5240.      effect until this function is called. As well Telix may sometimes take
  5241.      up to 15 seconds to update the status bar (and in some cases while
  5242.      scripts are running, won't update it at all). Calling this function
  5243.      ensures that the status bar is updated.
  5244.      Telix v3.21 - SALT Programming                Built-in Functions    90
  5245.  
  5246.  
  5247.  
  5248.      ■  Return Value
  5249.  
  5250.      None.
  5251.  
  5252.      ■  Example
  5253.  
  5254.      int temp;               // reverse current terminal colors
  5255.      temp = back_color;
  5256.      back_color = fore_color;
  5257.      fore_color = temp;
  5258.      update_term();
  5259.  
  5260.  
  5261.      USAGELOG
  5262.      ──────────────────────────────────────────────────────────────────────
  5263.  
  5264.      ■  Summary
  5265.  
  5266.      usagelog(str <filename>);
  5267.  
  5268.      ■  Description
  5269.  
  5270.      The usagelog function is used to manipulate the Telix usage log fa-
  5271.      cility.
  5272.  
  5273.      If <filename> is an empty string (""), Telix will ask for the filename
  5274.      to open the usage log to, as if the user had pressed Alt-U in terminal
  5275.      mode.
  5276.  
  5277.      If <filename> contains a valid filename, the usage log is opened to
  5278.      that file. The standard usage log is usually called "TELIX.USE".
  5279.  
  5280.      If <filename> is "*CLOSE*", and the usage log is currently open, it is
  5281.      closed.
  5282.  
  5283.      ■  Return Value
  5284.  
  5285.      A value of -1 is returned if there is a problem performing the indi-
  5286.      cated operation, otherwise a non-zero (TRUE) value is returned.
  5287.  
  5288.      ■  See Also
  5289.  
  5290.      ustamp, usage_stat
  5291.      _usage_fname
  5292.  
  5293.      ■  Example
  5294.  
  5295.      usagelog("TELIX.USE");
  5296.  
  5297.  
  5298.      USAGE_STAT
  5299.      ──────────────────────────────────────────────────────────────────────
  5300.  
  5301.      ■  Summary
  5302.  
  5303.      usage_stat();
  5304.      Telix v3.21 - SALT Programming                Built-in Functions    91
  5305.  
  5306.  
  5307.  
  5308.      ■  Description
  5309.  
  5310.      The usage_stat function returns an integer value representing the cur-
  5311.      rent status of the Usage Log. If the Usage Log is currently open, a
  5312.      non-zero (TRUE) value is returned, otherwise a value of zero (FALSE)
  5313.      is returned.
  5314.  
  5315.      ■  Return Value
  5316.  
  5317.      An integer values as described above.
  5318.  
  5319.      ■  See Also
  5320.  
  5321.      usagelog, capture_stat
  5322.  
  5323.  
  5324.      USTAMP
  5325.      ──────────────────────────────────────────────────────────────────────
  5326.  
  5327.      ■  Summary
  5328.  
  5329.      ustamp(str <text>, int <new_entry>, int <add_nl>);
  5330.  
  5331.      ■  Description
  5332.  
  5333.      The ustamp function is used to place (stamp) text into the Telix usage
  5334.      log. If the usage log is currently not open, this function call is
  5335.      simply ignored. <text> is the entry that should be placed into the us-
  5336.      age log. If <new_entry> contains a non-zero (TRUE) value, the current
  5337.      date/time is placed ahead of the text, otherwise it is assumed that
  5338.      this is a continuation of a previous entry and no date/time is added.
  5339.      If <add_nl> (add new line) is a non-zero (TRUE) value, a Carriage Re-
  5340.      turn and Line Feed character are added after the entry. This is usu-
  5341.      ally the case unless something else must be added on the same line.
  5342.  
  5343.      ■  Return Value
  5344.  
  5345.      A value of -1 is returned if there is a problem writing to the usage
  5346.      log, otherwise a non-zero (TRUE) value is returned.
  5347.  
  5348.      ■  See Also
  5349.  
  5350.      usagelog
  5351.  
  5352.      ■  Example
  5353.  
  5354.      ustamp("Calling user subroutine... ", 1, 0);
  5355.      if (user_sub == -1)
  5356.       ustamp("Failed!, 0, 1);
  5357.      else
  5358.       ustamp("Successful", 0, 1);
  5359.      Telix v3.21 - SALT Programming                Built-in Functions    92
  5360.  
  5361.  
  5362.  
  5363.      VGETCHR
  5364.      ──────────────────────────────────────────────────────────────────────
  5365.  
  5366.      ■  Summary
  5367.  
  5368.      vgetchr();
  5369.  
  5370.      ■  Description
  5371.  
  5372.      The vgetchr function is used to read the character (including color
  5373.      information) at the current cursor position on the video screen. The
  5374.      return value contains the character in the first (low) byte, and the
  5375.      color of the character in the higher (second) byte. Each component may
  5376.      be extracted using the & and / operators as shown in the example be-
  5377.      low. Basically, if 'c' is the returned character/color value, the
  5378.      character alone may be obtained by using the expression
  5379.  
  5380.           (c & 255)
  5381.  
  5382.      while the color value is
  5383.  
  5384.           (c / 256)
  5385.  
  5386.      ■  Return Value
  5387.  
  5388.      An integer value as described above.
  5389.  
  5390.      ■  See Also
  5391.  
  5392.      vgetchrs, vgetchrsa, vputchr
  5393.  
  5394.      ■  Example
  5395.  
  5396.      int chr;
  5397.      chr = vgetchr();      // Get char/color at current cursor position
  5398.      printsc("The character was ");
  5399.      printc(chr & 255);    // get character by masking out color byte
  5400.      printsc(" with a color value of ");
  5401.      printn(chr / 256);     // shift color byte
  5402.  
  5403.  
  5404.      VGETCHRS, VGETCHRSA
  5405.      ──────────────────────────────────────────────────────────────────────
  5406.  
  5407.      ■  Summary
  5408.  
  5409.      vgetchrs(int <x>, int <y>, str <buf>, int <pos>, int <num>);
  5410.  
  5411.      vgetchrsa(int <x>, int <y>, str <buf>, int <pos>, int <num>);
  5412.  
  5413.      ■  Description
  5414.  
  5415.      The vgetchrs and vgetchrsa functions are used to read multiple char-
  5416.      acters starting from a spot on the screen into a specified variable.
  5417.      The first function saves only the characters (a sequence of bytes)
  5418.      while the second saves both the characters and color attributes (a se-
  5419.      ries of double bytes). <x>,<y> is the spot on the screen to start
  5420.      Telix v3.21 - SALT Programming                Built-in Functions    93
  5421.  
  5422.  
  5423.  
  5424.      reading characters. <buf> is the string variable to put characters
  5425.      into, starting at an offset of <pos> in the variable. Note that each
  5426.      character read in with vgetchrsa will take up two bytes in the string
  5427.      variable, since the color attribute is also saved. Note also that
  5428.      these functions do not put a 0 (NULL, or end of string character) at
  5429.      the end of the sequence of characters they grab. If the characters re-
  5430.      turned by vgetchrs are to be manipulated as a string a 0 must be added
  5431.      at the end with the setchr function.
  5432.  
  5433.      ■  Return Value
  5434.  
  5435.      None.
  5436.  
  5437.      ■  See Also
  5438.  
  5439.      vgetchr, vputchrs, vputchrsa
  5440.  
  5441.      ■  Example
  5442.  
  5443.      // copy 20 characters starting from 10,10 on the screen to 20,20
  5444.      // Don't keep color attributes
  5445.      str buffer[20];
  5446.      vgetchrs(10, 10, buffer, 0, 20);
  5447.      vputchrs(20, 20, buffer, 0, 20);
  5448.  
  5449.      // copy a 20 by 10 grid of characters with a left hand corner of
  5450.      // 10,5 to 40,7, and keep color attributes
  5451.      str buffer[400];   // 20 wide * 10 tall * 2 bytes per character
  5452.      int y;
  5453.      for (y = 5; y < 15; y = y+1)         // read chars in a loop
  5454.       vgetchrsa(10, y, buffer, 2 * 20 * (y - 5), 20);
  5455.      for (y = 7; y < 17; y = y+1)         // now write them in a loop
  5456.       vputchrs(10, y, buffer, 2 * 20 * (y - 7), 20);
  5457.  
  5458.  
  5459.      VPUTCHR
  5460.      ──────────────────────────────────────────────────────────────────────
  5461.  
  5462.      ■  Summary
  5463.  
  5464.      vputchr(int <chr>);
  5465.  
  5466.      ■  Description
  5467.  
  5468.      The vputchr function is used to place a character on the screen at the
  5469.      current cursor position, specifying color information at the same
  5470.      time. <chr> is the character to place on the screen. the low byte con-
  5471.      tains the ASCII value of the character, while the second byte contains
  5472.      the color value. In general, a if 'c' is the character, and 'color' is
  5473.      the color to use, the proper value is obtained with the expression
  5474.  
  5475.           (c + color * 256)
  5476.  
  5477.      ■  Return Value
  5478.  
  5479.      None.
  5480.      Telix v3.21 - SALT Programming                Built-in Functions    94
  5481.  
  5482.  
  5483.  
  5484.      ■  See Also
  5485.  
  5486.      vgetchr
  5487.  
  5488.      ■  Example
  5489.  
  5490.      // Place an inverse 'X' in the left top corner of the screen
  5491.      gotoxy(0, 0);
  5492.      vputchr('X' + 112 * 256);
  5493.  
  5494.  
  5495.      VPUTCHRS, VPUTCHRSA
  5496.      ──────────────────────────────────────────────────────────────────────
  5497.  
  5498.      ■  Summary
  5499.  
  5500.      vputchrs(int <x>, int <y>, str <buf>, int <pos>, int <num>, int
  5501.      <attr>);
  5502.  
  5503.      vputchrsa(int <x>, int <y>, str <buf>, int <pos>, int <num>);
  5504.  
  5505.      ■  Description
  5506.  
  5507.      The vputchrs and vputchrsa functions are used to write multiple char-
  5508.      acters from a spot in a string variable onto the screen at a certain
  5509.      position. The first function assumes that the string contains charac-
  5510.      ters only, and writes them to the screen using a color attribute of
  5511.      <attr>, as described in Appendix C. The second function assumes that
  5512.      each character in the string is immediately followed by a color value
  5513.      (a series of double bytes). <x>,<y> is the spot on the screen to start
  5514.      writing characters. <buf> is the string variable to read characters
  5515.      from, starting at an offset of <pos> in the variable. Note that each
  5516.      character written with vputchrsa will take up two bytes in the string
  5517.      variable, since the color attribute is also there, so the offset
  5518.      should reflect this.
  5519.  
  5520.      ■  Return Value
  5521.  
  5522.      None.
  5523.  
  5524.      ■  See Also
  5525.  
  5526.      vputchr, vgetchrs, vgetchrsa
  5527.  
  5528.      ■  Example
  5529.  
  5530.      // copy 20 characters starting from 10,10 on the screen to 20,20
  5531.      // Don't keep color attributes
  5532.      str buffer[20];
  5533.      vgetchrs(10, 10, buffer, 0, 20);
  5534.      vputchrs(20, 20, buffer, 0, 20);
  5535.  
  5536.      // copy a 20 by 10 grid of characters with a left hand corner of
  5537.      // 10,5 to 40,7, and keep color attributes
  5538.      str buffer[400];   // 20 wide * 10 tall * 2 bytes per character
  5539.      int y;
  5540.      for (y = 5; y < 15; y = y+1)         // read chars in a loop
  5541.      Telix v3.21 - SALT Programming                Built-in Functions    95
  5542.  
  5543.  
  5544.  
  5545.       vgetchrsa(10, y, buffer, 2 * 20 * (y - 5), 20);
  5546.      for (y = 7; y < 17; y = y+1)         // now write them in a loop
  5547.       vputchrs(10, y, buffer, 2 * 20 * (y - 7), 20);
  5548.  
  5549.  
  5550.      VRSTRAREA
  5551.      ──────────────────────────────────────────────────────────────────────
  5552.  
  5553.      ■  Summary
  5554.  
  5555.      vrstrarea(int <vhandle>);
  5556.  
  5557.      ■  Description
  5558.  
  5559.      The vrstrarea function is used to restore a previously saved portion
  5560.      of the screen. <vhandle> is the video information handle returned by a
  5561.      previous call to vsavearea, which saved the screen area.
  5562.  
  5563.      Note, it is very important that <vhandle> is a valid handle, returned
  5564.      by a previous call to vsavearea, or unpredictable results will happen.
  5565.  
  5566.      ■  Return Value
  5567.  
  5568.      None.
  5569.  
  5570.      ■  See Also
  5571.  
  5572.      vsavearea
  5573.  
  5574.  
  5575.      VSAVEAREA
  5576.      ──────────────────────────────────────────────────────────────────────
  5577.  
  5578.      ■  Summary
  5579.  
  5580.      vsavearea(int <x1>, int <y1>, int <x2>, int <y2>);
  5581.  
  5582.      ■  Description
  5583.  
  5584.      The vsavearea function is used to save a rectangular portion of the
  5585.      screen (to be later restored). <x1>,<y1> is the upper left corner of
  5586.      the area to save, while <x2>,<y2> is the lower right corner. Charac-
  5587.      ters (and their colors) currently on the screen in this rectangle are
  5588.      saved in a buffer, and a 'handle' is returned, which must be stored
  5589.      and used in the subsequent call to vrstrarea to restore the saved
  5590.      area. If not enough memory exists to save the video bytes, a value of
  5591.      -1 is returned instead.
  5592.  
  5593.      Note that Telix has only a limited amount of space for allocating to
  5594.      video buffers of this type. At one time, only about as much area as
  5595.      would amount to a full screen should be saved with calls to this func-
  5596.      tion.
  5597.  
  5598.      It is also very important that for every call to this function, there
  5599.      is a subsequent call to vrstrarea. If this is not done, memory will
  5600.      become used up until no more is left.
  5601.      Telix v3.21 - SALT Programming                Built-in Functions    96
  5602.  
  5603.  
  5604.  
  5605.      ■  Return Value
  5606.  
  5607.      An integer value representing a 'handle' to the saved area.
  5608.  
  5609.      ■  See Also
  5610.  
  5611.      vrstrarea
  5612.  
  5613.      ■  Example
  5614.  
  5615.      int vhandle;
  5616.      vhandle = vsavearea(0, 0, 79, 24);  // save the current screen
  5617.      myfunc();                           // call a function
  5618.                                          // which modifies screen
  5619.      vrstrarea(vhandle);                 // restore previous screen
  5620.  
  5621.      WAITFOR
  5622.      ──────────────────────────────────────────────────────────────────────
  5623.  
  5624.      ■  Summary
  5625.  
  5626.      waitfor(str <waitstr>, int <timeout>);
  5627.  
  5628.      ■  Description
  5629.  
  5630.      The waitfor function is used to wait for the given string to come in
  5631.      over the serial port. Timeout is the maximum amount of time, in sec-
  5632.      onds, to wait for the string. Case is not significant, and the string
  5633.      must be no longer than 40 characters.
  5634.  
  5635.      ■  Return Value
  5636.  
  5637.      A non-zero (TRUE) value is returned if the string is received from the
  5638.      serial port in the given time, otherwise a zero (FALSE) value is re-
  5639.      turned.
  5640.  
  5641.      ■  See Also
  5642.  
  5643.      track
  5644.  
  5645.      ■  Example
  5646.  
  5647.      if (waitfor("name?", 180))
  5648.       prints("The string 'name?' came in from the comm port.");
  5649.      else
  5650.       {
  5651.        prints("The string 'name?' did not come in from the");
  5652.        prints("comm port in 3 minutes!");
  5653.       }
  5654.      Telix v3.21 - SALT Programming                  System Variables    97
  5655.  
  5656.  
  5657.  
  5658.      5.  SYSTEM VARIABLES
  5659.  
  5660.      Telix has quite a large number predefined built-in variables. They are
  5661.      called System Variables and are used to store many preferences. There
  5662.      are both string and numeric system variables, and they are accessed
  5663.      just as you would access any other variable. To help distinguish them
  5664.      apart from normal variables, and to avoid confusion, they all start
  5665.      with an underscore (_) character.
  5666.  
  5667.      The following pages contain descriptions of all the system variables.
  5668.      For each variable, a summary and a description are given. An example
  5669.      of actual usage of the variable will often be given.
  5670.  
  5671.      The variables are listed in alphabetical order. So that you may find
  5672.      related variables (and built-in functions), most variable descriptions
  5673.      have a 'See also' section, which lists related variables and func-
  5674.      tions.
  5675.      Telix v3.21 - SALT Programming                  System Variables    98
  5676.  
  5677.  
  5678.  
  5679.      _ADD_LF
  5680.      ──────────────────────────────────────────────────────────────────────
  5681.  
  5682.      ■  Summary
  5683.  
  5684.      int _add_lf;
  5685.  
  5686.      ■  Description
  5687.  
  5688.      If the _add_lf system variable is set to non-zero (TRUE), a Line Feed
  5689.      character is automatically added after every Carriage Return character
  5690.      that comes in.
  5691.  
  5692.  
  5693.      _ALARM_ON
  5694.      ──────────────────────────────────────────────────────────────────────
  5695.  
  5696.      ■  Summary
  5697.  
  5698.      int _alarm_on;
  5699.  
  5700.      ■  Description
  5701.  
  5702.      If the _alarm_on system variable is set to non-zero (TRUE), alarms are
  5703.      enabled in Telix. Note that if the _sound_off system variable is set
  5704.      to zero (FALSE), alarms will not be heard no matter what the state of
  5705.      this variable.
  5706.  
  5707.      ■  See Also
  5708.  
  5709.      alarm
  5710.      _sound_on
  5711.  
  5712.  
  5713.      _ANSWERBACK_STR
  5714.      ──────────────────────────────────────────────────────────────────────
  5715.  
  5716.      ■  Summary
  5717.  
  5718.      str _answerback_str[19];
  5719.  
  5720.      ■  Description
  5721.  
  5722.      The _answerback_str system variable holds the string which Telix will
  5723.      send when a Ctrl-E (ENQ) character is received while in terminal mode.
  5724.      If this string is empty, nothing is sent. Note that if Compuserve B
  5725.      transfers are enabled, the answerback string will not be sent, since
  5726.      CIS B uses the Ctrl-E as part of the transfer process. Maximum length
  5727.      is 19 characters.
  5728.  
  5729.  
  5730.      _ASC_RCRTRANS - _ASC_STRIPH
  5731.      ──────────────────────────────────────────────────────────────────────
  5732.  
  5733.      ■  Summary
  5734.  
  5735.      int _asc_rcrtrans;
  5736.      Telix v3.21 - SALT Programming                  System Variables    99
  5737.  
  5738.  
  5739.  
  5740.      int _asc_remabort;
  5741.  
  5742.      int _asc_rlftrans;
  5743.  
  5744.      int _asc_scpacing;
  5745.  
  5746.      int _asc_scrtrans;
  5747.  
  5748.      int _asc_secho;
  5749.  
  5750.      int _asc_sexpand;
  5751.  
  5752.      int _asc_slftrans;
  5753.  
  5754.      int _asc_slpacing;
  5755.  
  5756.      int _asc_spacechr;
  5757.  
  5758.      int _asc_striph;
  5759.  
  5760.      ■  Description
  5761.  
  5762.      _asc_rcrtrans determines what Telix does with Carriage Return char-
  5763.      acters during ASCII receives. 0 = do nothing; 1 = strip; 2 = add Line
  5764.      Feed afterwards.
  5765.  
  5766.      _asc_remabort is the character which when received from the remote
  5767.      side during an ASCII transfer is a signal to abort the transfer.
  5768.  
  5769.      _asc_rlftrans determines what Telix does with Line Feed characters
  5770.      during ASCII receives. 0 = do nothing; 1 = strip; 2 = add Carriage Re-
  5771.      turn before.
  5772.  
  5773.      _asc_scpacing is the time in milliseconds which Telix should wait be-
  5774.      fore transmitting each character during ASCII sends.
  5775.  
  5776.      _asc_scrtrans determines what Telix does with Carriage Return char-
  5777.      acters during ASCII sends. 0 = do nothing; 1 = strip; 2 = add Line
  5778.      Feed afterwards.
  5779.  
  5780.      If _asc_secho is set to non-zero (TRUE), Telix will echo each char-
  5781.      acter during ASCII sends.
  5782.  
  5783.      If _asc_sexpand is set to non-zero (TRUE), Telix will expand blank
  5784.      lines to a space character, during ASCII sends.
  5785.  
  5786.      _asc_slftran determines what Telix does with Line Feed characters dur-
  5787.      ing ASCII sends. 0 = do nothing; 1 = strip; 2 = add Carriage Return
  5788.      before.
  5789.  
  5790.      _asc_slpacing is the time in tenths of seconds which Telix should wait
  5791.      before transmitting each line during ASCII sends.
  5792.  
  5793.      _asc_spacechr is the character which Telix should wait for during
  5794.      ASCII sends, before transmitting each line (0 means no wait).
  5795.      Telix v3.21 - SALT Programming                 System Variables    100
  5796.  
  5797.  
  5798.  
  5799.      If _asc_striph is set to non-zero (TRUE), Telix will strip the high
  5800.      (most significant) bit of each character in an ASCII transfer.
  5801.  
  5802.  
  5803.      _AUTO_ANS_STR
  5804.      ──────────────────────────────────────────────────────────────────────
  5805.  
  5806.      ■  Summary
  5807.  
  5808.      str _auto_ans_str[48];
  5809.  
  5810.      ■  Description
  5811.  
  5812.      The _auto_ans_str system variable holds the string that should be sent
  5813.      to the modem to make it automatically answer the phone when it rings.
  5814.      This string is used by the Host Mode script, among others. The string
  5815.      will possibly include translation characters as described in the Telix
  5816.      manual in the section by that name, and should be sent to the modem
  5817.      with the cputs_tr function. Maximum length is 49 characters.
  5818.  
  5819.      ■  See Also
  5820.  
  5821.      _mdm_init_str
  5822.  
  5823.  
  5824.      _BACK_COLOR
  5825.      ──────────────────────────────────────────────────────────────────────
  5826.  
  5827.      ■  Summary
  5828.  
  5829.      int _back_color;
  5830.  
  5831.      ■  Description
  5832.  
  5833.      The _back_color system variable contains the background color which
  5834.      should be used for text in terminal mode. Allowable values are from 0
  5835.      - 15. Note that changes to this variable may not be reflected until
  5836.      the screen is cleared.
  5837.  
  5838.      ■  See Also
  5839.  
  5840.      _fore_color
  5841.  
  5842.  
  5843.      _CAPTURE_FNAME
  5844.      ──────────────────────────────────────────────────────────────────────
  5845.  
  5846.      ■  Summary
  5847.  
  5848.      str _capture_fname[64];
  5849.  
  5850.      ■  Description
  5851.  
  5852.      The _capture_fname system variable holds the default capture file
  5853.      filename. The maximum length is 64 characters.
  5854.      Telix v3.21 - SALT Programming                 System Variables    101
  5855.  
  5856.  
  5857.  
  5858.      ■  See Also
  5859.  
  5860.      capture
  5861.      _usage_fname
  5862.  
  5863.  
  5864.      _CISB_AUTO
  5865.      ──────────────────────────────────────────────────────────────────────
  5866.  
  5867.      ■  Summary
  5868.  
  5869.      int _cisb_auto;
  5870.  
  5871.      ■  Description
  5872.  
  5873.      The _cisb_auto system variable controls whether Compuserve Quick B
  5874.      auto file transfer are allowed. If this variable is set to a 0 (FALSE)
  5875.      value, requests by the remote (Compuserve) to transfer files using the
  5876.      Quick B protocol will be ignored.
  5877.  
  5878.      ■  See Also
  5879.  
  5880.      _zmod_auto
  5881.  
  5882.  
  5883.      _CONNECT_STR
  5884.      ──────────────────────────────────────────────────────────────────────
  5885.  
  5886.      ■  Summary
  5887.  
  5888.      str _connect_str[19];
  5889.  
  5890.      ■  Description
  5891.  
  5892.      The _connect_str system variable holds the string which Telix should
  5893.      scan for when dialing, and should take to mean that a connection has
  5894.      been established. For Hayes type modems it is usually set to
  5895.      "CONNECT". Maximum length is 19 characters.
  5896.  
  5897.      ■  See Also
  5898.  
  5899.      _no_connect1 - _no_connect4
  5900.  
  5901.  
  5902.      _DATE_FORMAT
  5903.      ──────────────────────────────────────────────────────────────────────
  5904.  
  5905.      ■  Summary
  5906.  
  5907.      int _date_format;
  5908.  
  5909.      ■  Description
  5910.  
  5911.      The contents of the _date_format system variable determines what for-
  5912.      mat Telix uses for date strings it produces, as follows:
  5913.      Telix v3.21 - SALT Programming                 System Variables    102
  5914.  
  5915.  
  5916.  
  5917.                     0    mm/dd/yy
  5918.                     1    dd/mm/yy
  5919.                     2    yy/mm/dd
  5920.  
  5921.      ■  See Also
  5922.  
  5923.      _time_format
  5924.      date
  5925.  
  5926.  
  5927.      _DEST_BS
  5928.      ──────────────────────────────────────────────────────────────────────
  5929.  
  5930.      ■  Summary
  5931.  
  5932.      int _dest_bs;
  5933.  
  5934.      ■  Description
  5935.  
  5936.      The _dest_bs system variable controls whether a backspace character
  5937.      received by Telix in Terminal Mode erases the character to the left of
  5938.      the cursor, or just moves the cursor on top of it on top of it without
  5939.      erasing it. If this variable is 0 (FALSE), Telix will treat the
  5940.      backspace as non-destructive, and destructive otherwise.
  5941.  
  5942.      ■  See Also
  5943.  
  5944.      _swap_bs
  5945.  
  5946.  
  5947.      _DIAL_PAUSE
  5948.      ──────────────────────────────────────────────────────────────────────
  5949.  
  5950.      ■  Summary
  5951.  
  5952.      int _dial_pause;
  5953.  
  5954.      ■  Description
  5955.  
  5956.      The _dial_pause system variable holds (in seconds) the amount of time
  5957.      to wait between the end of one dialing attempt and the beginning of
  5958.      another. Most modems don't need more than a 1 second pause.
  5959.  
  5960.  
  5961.      _DIAL_TIME
  5962.      ──────────────────────────────────────────────────────────────────────
  5963.  
  5964.      ■  Summary
  5965.  
  5966.      int _dial_time;
  5967.  
  5968.      ■  Description
  5969.  
  5970.      The _dial_time system variable holds the amount of time Telix should
  5971.      wait for a connection when dialing, in seconds (e.g. 30).
  5972.      Telix v3.21 - SALT Programming                 System Variables    103
  5973.  
  5974.  
  5975.  
  5976.      ■  See Also
  5977.  
  5978.      _dial_pause
  5979.  
  5980.  
  5981.      _DIALPOST
  5982.      ──────────────────────────────────────────────────────────────────────
  5983.  
  5984.      ■  Summary
  5985.  
  5986.      str _dialpost[19];
  5987.  
  5988.      ■  Description
  5989.  
  5990.      The _dialpost system variable holds the string (the dialing postfix)
  5991.      which should be sent to the modem after the number, when dialing. For
  5992.      Hayes type modems, it is usually just a Carriage Return. Maximum
  5993.      length is 19 characters. This string will possibly include some trans-
  5994.      lation characters, as described in the Telix manual, and should be
  5995.      sent to the modem with the cputs_tr function.
  5996.  
  5997.      ■  See Also
  5998.  
  5999.      _dialpref, _dialpref2, _dialpref3, _redial_stop
  6000.  
  6001.  
  6002.      _DIALPREF
  6003.      ──────────────────────────────────────────────────────────────────────
  6004.  
  6005.      ■  Summary
  6006.  
  6007.      str _dialpref[19];
  6008.  
  6009.      str _dialpref2[19];
  6010.  
  6011.      str _dialpref3[19];
  6012.  
  6013.      ■  Description
  6014.  
  6015.      The _dialpref system variable holds the string which should be sent to
  6016.      the modem before the number, when dialing. For Hayes type modems, it
  6017.      is usually set to "ATDT". Maximum length is 19 characters. This string
  6018.      will possibly include translation characters, as described in the
  6019.      Telix manual, and should be sent to the modem with the cputs_tr func-
  6020.      tion.
  6021.  
  6022.      The _dialpref2 and _dialpref3 variables are the other two dialing pre-
  6023.      fixes that may be defined in Telix.
  6024.  
  6025.      ■  See Also
  6026.  
  6027.      _dialpost, _redial_stop
  6028.      Telix v3.21 - SALT Programming                 System Variables    104
  6029.  
  6030.  
  6031.  
  6032.      _DIR_PROG
  6033.      ──────────────────────────────────────────────────────────────────────
  6034.  
  6035.      ■  Summary
  6036.  
  6037.      str _dir_prog[15];
  6038.  
  6039.      ■  Description
  6040.  
  6041.      The _dir_prog system variable holds the name of the disk directory
  6042.      program that should be run when the user selects the 'Files directory'
  6043.      option of the DOS Functions menu. If this variable is left empty (""),
  6044.      the DOS 'dir' command is used. Maximum length is 15 characters.
  6045.  
  6046.  
  6047.      _DISP_FREE
  6048.      ──────────────────────────────────────────────────────────────────────
  6049.  
  6050.      ■  Summary
  6051.  
  6052.      int _disp_free
  6053.  
  6054.      ■  Description
  6055.  
  6056.      If the _disp_free system variable is set to non-zero (TRUE), Telix
  6057.      will display the amount of free space available on the drive when the
  6058.      user presses Alt-R to download a file.
  6059.  
  6060.  
  6061.      _DOWN_DIR
  6062.      ──────────────────────────────────────────────────────────────────────
  6063.  
  6064.      ■  Summary
  6065.  
  6066.      str _down_dir[64];
  6067.  
  6068.      ■  Description
  6069.  
  6070.      The _down_dir system variable holds the default download directory
  6071.      name. When a file is downloaded (received), if the user specifies a
  6072.      drive and/or directory in the name, the file is put there. However, if
  6073.      only a name is specified, the file is placed in the directory in-
  6074.      dicated by _down_dir. The maximum length is 64 characters, and this
  6075.      string should end with the backslash character, '\'.
  6076.  
  6077.      ■  See Also
  6078.  
  6079.      _up_dir, receive
  6080.  
  6081.  
  6082.      _EDITOR
  6083.      ──────────────────────────────────────────────────────────────────────
  6084.  
  6085.      ■  Summary
  6086.  
  6087.      str _editor[64];
  6088.      Telix v3.21 - SALT Programming                 System Variables    105
  6089.  
  6090.  
  6091.  
  6092.      ■  Description
  6093.  
  6094.      The _editor system variable holds the name of the editor that should
  6095.      be run when the user presses Alt-A. The editor should either be on the
  6096.      DOS Path, in which case only the name needs to be given, or else the
  6097.      entire pathname (drive, directory, name) must be given. The maximum
  6098.      length is 64 characters. If a batch file is to be run the .BAT exten-
  6099.      sion must be given.
  6100.  
  6101.  
  6102.      _ENTRY_ENUM
  6103.      ──────────────────────────────────────────────────────────────────────
  6104.  
  6105.      ■  Summary
  6106.  
  6107.      int _entry_enum;
  6108.  
  6109.      ■  Description
  6110.  
  6111.      The _entry_enum variable is set by the dialing routines. When a con-
  6112.      nection is established while dialing, the entry number of the dialing
  6113.      directory entry connected to is stored here. If a manual number is
  6114.      connected to, the value 0 is stored here.
  6115.  
  6116.      ■  See Also
  6117.  
  6118.      _entry_name
  6119.      dial, redial
  6120.  
  6121.  
  6122.      _ENTRY_NAME - _ENTRY_PASS
  6123.      ──────────────────────────────────────────────────────────────────────
  6124.  
  6125.      ■  Summary
  6126.  
  6127.      str _entry_name[29];
  6128.  
  6129.      str _entry_num[17];
  6130.  
  6131.      str _entry_pass[14];
  6132.  
  6133.      ■  Description
  6134.  
  6135.      The _entry_name system variable is set by the dialing routines. When a
  6136.      connection has been established the name portion of the dialing direc-
  6137.      tory entry connected to is copied here, for use by script files. The
  6138.      maximum length is 29 characters.
  6139.  
  6140.      The _entry_num system variable is set in the same way, and holds the
  6141.      phone number of the entry connected to. The maximum length is 17 char-
  6142.      acters.
  6143.  
  6144.      The entry_pass system variable is set in the same way, and holds the
  6145.      password from the entry connected to. This may be used to perform lo-
  6146.      gons. The maximum length is 14 characters.
  6147.      Telix v3.21 - SALT Programming                 System Variables    106
  6148.  
  6149.  
  6150.  
  6151.      ■  See Also
  6152.  
  6153.      _entry_enum
  6154.      dial, redial
  6155.  
  6156.  
  6157.      _EXT_FILESPEC;
  6158.      ──────────────────────────────────────────────────────────────────────
  6159.  
  6160.      ■  Summary
  6161.  
  6162.      str _ext_filespec[64];
  6163.  
  6164.      ■  Description
  6165.  
  6166.      This variable is for use by scripts implementing external protocols.
  6167.      When an external protocol has been defined as called by a script, this
  6168.      variable is first loaded with the filespec (file specification) typed
  6169.      by the user at the transfer menu. The appropriate script is then run.
  6170.      The script can for example pass this name to a program which imple-
  6171.      ments the actual protocol. Note that some file transfer protocols do
  6172.      not require the user to supply the name on downloads, in which case
  6173.      this variable is left empty.
  6174.  
  6175.  
  6176.      _FORE_COLOR
  6177.      ──────────────────────────────────────────────────────────────────────
  6178.  
  6179.      ■  Summary
  6180.  
  6181.      int _fore_color;
  6182.  
  6183.      ■  Description
  6184.  
  6185.      The _fore_color system variable contains the foreground color which
  6186.      should be used for text in terminal mode. Allowable values are from 0
  6187.      - 15. Note that changes to this variable may not be reflected until
  6188.      the screen is cleared.
  6189.  
  6190.      ■  See Also
  6191.  
  6192.      _back_color
  6193.  
  6194.  
  6195.      _IMAGE_FILE;
  6196.      ──────────────────────────────────────────────────────────────────────
  6197.  
  6198.      ■  Summary
  6199.  
  6200.      str _image_file[64];
  6201.  
  6202.      ■  Description
  6203.  
  6204.      The _image_file system variable holds the full name of the file that
  6205.      screen images are saved to when the user presses Alt-I while in ter-
  6206.      minal mode. If this file already exists, data is appended to it.
  6207.      Telix v3.21 - SALT Programming                 System Variables    107
  6208.  
  6209.  
  6210.  
  6211.      _LOCAL_ECHO
  6212.      ──────────────────────────────────────────────────────────────────────
  6213.  
  6214.      ■  Summary
  6215.  
  6216.      int _local_echo;
  6217.  
  6218.      ■  Description
  6219.  
  6220.      The _local_echo system variable controls whether or not characters
  6221.      typed in terminal mode are echoed on the screen. If _local_echo is set
  6222.      to non-zero (TRUE), characters are echoed, otherwise they are not.
  6223.  
  6224.  
  6225.      _MDM_HANG_STR
  6226.      ──────────────────────────────────────────────────────────────────────
  6227.  
  6228.      ■  Summary
  6229.  
  6230.      str _mdm_hang_str[19];
  6231.  
  6232.      ■  Description
  6233.  
  6234.      The _mdm_hang_str system variable holds the string that should be sent
  6235.      to the modem to hang it up when the user presses Alt-H. Note that this
  6236.      string will only be sent to the modem if Telix can't first hang-up the
  6237.      modem by turning off a signal on the serial port called the DTR line.
  6238.      This string may contain translation characters as defined in the Telix
  6239.      manual, and should be sent to the modem with the cputs_tr function.
  6240.      Maximum length is 19 characters.
  6241.  
  6242.      ■  See Also
  6243.  
  6244.      _mdm_init_str, _auto_ans_str
  6245.  
  6246.  
  6247.      _MDM_INIT_STR
  6248.      ──────────────────────────────────────────────────────────────────────
  6249.  
  6250.      ■  Summary
  6251.  
  6252.      str _mdm_init_str[49];
  6253.  
  6254.      ■  Description
  6255.  
  6256.      The _mdm_init system variable holds the string that should be sent to
  6257.      the modem when Telix starts-up. It is usually used to make sure cer-
  6258.      tain settings in the modem are right. This string may contain transla-
  6259.      tion characters as defined in the Telix manual, and should be sent to
  6260.      the modem with the cputs_tr function. Maximum length is 49 characters.
  6261.  
  6262.      ■  See Also
  6263.  
  6264.      _auto_ans_str, _mdm_hang_str
  6265.      Telix v3.21 - SALT Programming                 System Variables    108
  6266.  
  6267.  
  6268.  
  6269.      _NO_CONNECT1 - _NO_CONNECT4
  6270.      ──────────────────────────────────────────────────────────────────────
  6271.  
  6272.      ■  Summary
  6273.  
  6274.      str _no_connect1[19];
  6275.  
  6276.      str _no_connect2[19];
  6277.  
  6278.      str _no_connect3[19];
  6279.  
  6280.      str _no_connect4[19];
  6281.  
  6282.      ■  Description
  6283.  
  6284.      These system variables contain the strings that Telix should scan for
  6285.      when dialing, and take to mean that a connection has not been estab-
  6286.      lished (i.e., the number was busy or there was no answer). The maximum
  6287.      length for each string is 19 characters.
  6288.  
  6289.      ■  See Also
  6290.  
  6291.      _connect_str
  6292.  
  6293.  
  6294.      _QDBAR_ON
  6295.      ──────────────────────────────────────────────────────────────────────
  6296.  
  6297.      ■  Summary
  6298.  
  6299.      int _qdbar_on;
  6300.  
  6301.      ■  Description
  6302.  
  6303.      If the _qdbar_on system variable is set to non-zero (TRUE), the quick
  6304.      dialing bar is shown first when Alt-D is pressed; otherwise the user
  6305.      is taken directly to the dialing directory screen.
  6306.  
  6307.  
  6308.      _REDIAL_STOP
  6309.      ──────────────────────────────────────────────────────────────────────
  6310.  
  6311.      ■  Summary
  6312.  
  6313.      str _redial_stop[19];
  6314.  
  6315.      ■  Description
  6316.  
  6317.      The _redial_stop system variable holds the string that should be sent
  6318.      to the modem to stop a dialing attempt. It usually just holds a Car-
  6319.      riage Return character. This string may contain translation characters
  6320.      as described in the Telix manual, and should be sent to the modem with
  6321.      the cputs_tr function. Maximum length is 19 characters.
  6322.  
  6323.      ■  See Also
  6324.  
  6325.      _dialpref, _dialpref2, _dialpref3, _dialpost
  6326.      Telix v3.21 - SALT Programming                 System Variables    109
  6327.  
  6328.  
  6329.  
  6330.      _SCR_CHK_KEY
  6331.      ──────────────────────────────────────────────────────────────────────
  6332.  
  6333.      ■  Summary
  6334.  
  6335.      int _scr_chk_key;
  6336.  
  6337.      ■  Description
  6338.  
  6339.      Between every command while executing a script file, Telix checks the
  6340.      keyboard buffer to see if the user has requested an abort. This how-
  6341.      ever gets in the way of the inkey function among others. As well, it
  6342.      is sometimes necessary to stop the user from being able to abort the
  6343.      script. If _scr_chk_key is set to zero (FALSE), Telix will no longer
  6344.      check for user aborts requests during script execution. Setting it
  6345.      back to non-zero (TRUE) will turn the checks back on. When modifying
  6346.      this variable in a script file, it is a good idea to save the old
  6347.      state in a scratch variable and restore it when done.
  6348.  
  6349.      ■  See Also
  6350.  
  6351.      inkey
  6352.  
  6353.  
  6354.      _SCRIPT_DIR
  6355.      ──────────────────────────────────────────────────────────────────────
  6356.  
  6357.      ■  Summary
  6358.  
  6359.      str _script_dir[64];
  6360.  
  6361.      ■  Description
  6362.  
  6363.      The _script_dir system variable holds the full path of the directory
  6364.      where Telix should look for compiled script files when a script is se-
  6365.      lected to be run. When a script is selected to be run, Telix uses this
  6366.      procedure: if the name includes the drive and/or directory, only that
  6367.      path is searched. If the name includes only the filename, the current
  6368.      directory is first searched for the script file, and then the direc-
  6369.      tory pointed to by the _script_dir variable. This string should end in
  6370.      the slash character, '\'. The maximum allowed length is 64 characters.
  6371.  
  6372.      ■  See Also
  6373.  
  6374.      _telix_dir, _up_dir, _down_dir
  6375.  
  6376.  
  6377.      _SOUND_ON
  6378.      ──────────────────────────────────────────────────────────────────────
  6379.  
  6380.      ■  Summary
  6381.  
  6382.      int _sound_on;
  6383.      Telix v3.21 - SALT Programming                 System Variables    110
  6384.  
  6385.  
  6386.  
  6387.      ■  Description
  6388.  
  6389.      If the _sound_on system variable is set to non-zero (TRUE) sound is
  6390.      enabled in Telix, otherwise all sound is shut off.
  6391.  
  6392.      ■  See Also
  6393.  
  6394.      _alarm_on
  6395.  
  6396.  
  6397.      _STRIP_HIGH
  6398.      ──────────────────────────────────────────────────────────────────────
  6399.  
  6400.      ■  Summary
  6401.  
  6402.      int _strip_high;
  6403.  
  6404.      ■  Description
  6405.  
  6406.      The _strip_high system variable controls what Telix does with the high
  6407.      (most significant) bit of incoming characters while in terminal mode.
  6408.      If this variable is set to s non-zero (TRUE) value, Telix will strip
  6409.      the high bit of incoming characters.
  6410.  
  6411.  
  6412.      _SWAP_BS
  6413.      ──────────────────────────────────────────────────────────────────────
  6414.  
  6415.      ■  Summary
  6416.  
  6417.      int _swap_bs;
  6418.  
  6419.      ■  Description
  6420.  
  6421.      The _swap_bs system variable controls what Telix sends when the
  6422.      Backspace key is pressed. If this variable is 0, Telix will send a
  6423.      Backspace character when Backspace is pressed, and a DEL character
  6424.      when Ctrl-Backspace is pressed. If this variable is set to 1, Telix
  6425.      will reverse these codes.
  6426.  
  6427.      ■  See Also
  6428.  
  6429.      _dest_bs
  6430.  
  6431.  
  6432.      _TELIX_DIR;
  6433.      ──────────────────────────────────────────────────────────────────────
  6434.  
  6435.      ■  Summary
  6436.  
  6437.      str _telix_dir[64];
  6438.  
  6439.      ■  Description
  6440.  
  6441.      The _telix_dir system variable holds the full path to reach the Telix
  6442.      program's base directory (e.g. 'C:\TELIX\'). Changing this variable is
  6443.      not recommended, as if a wrong value is used, Telix will probably not
  6444.      Telix v3.21 - SALT Programming                 System Variables    111
  6445.  
  6446.  
  6447.  
  6448.      be able to find many needed files. The maximum length is 64 charac-
  6449.      ters.
  6450.  
  6451.      If this variable is changed, it is imperative that a backslash char-
  6452.      acter, '\', is found at the end. Telix builds paths to many files by
  6453.      appending certain names to this string. If the slash is missing, it
  6454.      will cause many problems.
  6455.  
  6456.      ■  See Also
  6457.  
  6458.      _script_dir, _up_dir, _down_dir
  6459.  
  6460.  
  6461.      _TIME_FORMAT
  6462.      ──────────────────────────────────────────────────────────────────────
  6463.  
  6464.      ■  Summary
  6465.  
  6466.      int _time_format;
  6467.  
  6468.      ■  Description
  6469.  
  6470.      The _time_format system variable determines what format Telix uses for
  6471.      time strings it produces. If _time_format is 0, Telix will use a 12
  6472.      hour format, otherwise a 24 hour format will be used.
  6473.  
  6474.      ■  See Also
  6475.  
  6476.      _date_format
  6477.      time
  6478.  
  6479.  
  6480.      _UP_DIR
  6481.      ──────────────────────────────────────────────────────────────────────
  6482.  
  6483.      ■  Summary
  6484.  
  6485.      str _up_dir[64];
  6486.  
  6487.      ■  Description
  6488.  
  6489.      The _up_dir system variable holds the default upload directory name.
  6490.      When a file is to be ed (sent), if the user specifies a drive and/or
  6491.      directory in the name, the file is taken from there. However, if only
  6492.      a name is specified, the file is searched for in the directory in-
  6493.      dicated by _up_dir. This variable should end with a slash character,
  6494.      '\'. The maximum length is 64 characters.
  6495.  
  6496.      ■  See Also
  6497.  
  6498.      _down_dir
  6499.      send
  6500.      Telix v3.21 - SALT Programming                 System Variables    112
  6501.  
  6502.  
  6503.  
  6504.      _USAGE_FNAME
  6505.      ──────────────────────────────────────────────────────────────────────
  6506.  
  6507.      ■  Summary
  6508.  
  6509.      str _usage_fname[64];
  6510.  
  6511.      ■  Description
  6512.  
  6513.      The _usage_fname system variable holds the default Usage Log filename.
  6514.      The maximum length is 64 characters.
  6515.  
  6516.      ■  See Also
  6517.  
  6518.      _capture_fname
  6519.      usagelog
  6520.  
  6521.  
  6522.      _ZMOD_AUTO
  6523.      ──────────────────────────────────────────────────────────────────────
  6524.  
  6525.      ■  Summary
  6526.  
  6527.      int _zmod_auto;
  6528.  
  6529.      ■  Description
  6530.  
  6531.      The _zmod_auto system variable controls whether or not Zmodem auto-
  6532.      downloads are allowed. If Telix is in terminal mode and receives an
  6533.      auto download request Telix will ignore it if this variable is set to
  6534.      a 0 (FALSE) value (however, the user can still receive the file by
  6535.      manually selecting the Zmodem protocol from the Alt-R menu).
  6536.  
  6537.      ■  See Also
  6538.  
  6539.      _cisb_auto
  6540.  
  6541.  
  6542.      _ZMOD_RCRASH
  6543.      ──────────────────────────────────────────────────────────────────────
  6544.  
  6545.      ■  Summary
  6546.  
  6547.      int _zmod_rcrash;
  6548.  
  6549.      ■  Description
  6550.  
  6551.      The _zmod_rcrash system variable controls whether the Zmodem receive
  6552.      Crash Recovery (resume) option is on. If this variable is set to a
  6553.      non-zero (TRUE) value, Telix will try to resume aborted transfers dur-
  6554.      ing a Zmodem download.
  6555.  
  6556.      ■  See Also
  6557.  
  6558.      _zmod_scrash
  6559.      Telix v3.21 - SALT Programming                 System Variables    113
  6560.  
  6561.  
  6562.  
  6563.      _ZMOD_SCRASH
  6564.      ──────────────────────────────────────────────────────────────────────
  6565.  
  6566.      ■  Summary
  6567.  
  6568.      int _zmod_scrash;
  6569.  
  6570.      ■  Description
  6571.  
  6572.      The _zmod_scrash system variable controls whether the Zmodem send
  6573.      Crash Recovery (resume) option is on. If this variable is set to a
  6574.      non-zero (TRUE) value, Telix will try to tell the other side to resume
  6575.      aborted transfers during a Zmodem upload.
  6576.  
  6577.      ■  See Also
  6578.  
  6579.      _zmod_rcrash
  6580.      Telix v3.21                                          Appendix A    114
  6581.  
  6582.  
  6583.  
  6584.      6.  APPENDIX A - ASCII CHARACTER SET
  6585.  
  6586.      The ASCII character set consists if 128 characters, with each char-
  6587.      acter having an ASCII value, in the range of 0 to 127. The IBM PC uses
  6588.      the IBM Extended ASCII set, which adds a further 128 values, to pro-
  6589.      vide extra symbols. The following table lists the regular ASCII char-
  6590.      acter set. The first column contains the ASCII control characters,
  6591.      which can not normally be printed, and are given by name.
  6592.  
  6593.      Dec Hex Ctrl Name    Dec Hex Chr   Dec Hex Chr     Dec Hex Chr
  6594.        0  00  ^@  NUL      32  20         64  40  @      96  60  `
  6595.        1  01  ^A  SOH      33  21  !      65  41  A      97  61  a
  6596.        2  02  ^B  STX      34  22  "      66  42  B      98  62  b
  6597.        3  03  ^C  ETX      35  23  #      67  43  C      99  63  c
  6598.        4  04  ^D  EOT      36  24  $      68  44  D     100  64  d
  6599.        5  05  ^E  ENQ      37  25  %      69  45  E     101  65  e
  6600.        6  06  ^F  ACK      38  26  &      70  46  F     102  66  f
  6601.        7  07  ^G  BEL      39  27  '      71  47  G     103  67  g
  6602.        8  08  ^H  BS       40  28  (      72  48  H     104  68  h
  6603.        9  09  ^I  HT       41  29  )      73  49  I     105  69  i
  6604.       10  0a  ^J  LF       42  2a  *      74  4a  J     106  6a  j
  6605.       11  0b  ^K  VT       43  2b  +      75  4b  K     107  6b  k
  6606.       12  0c  ^L  FF       44  2c  ,      76  4c  L     108  6c  l
  6607.       13  0d  ^M  CR       45  2d  -      77  4d  M     109  6d  m
  6608.       14  0e  ^N  SO       46  2e  .      78  4e  N     110  6e  n
  6609.       15  0f  ^O  SI       47  2f  /      79  4f  O     111  6f  o
  6610.       16  10  ^P  DLE      48  30  0      80  50  P     112  70  p
  6611.       17  11  ^Q  DC1      49  31  1      81  51  Q     113  71  q
  6612.       18  12  ^R  DC2      50  32  2      82  52  R     114  72  r
  6613.       19  13  ^S  DC3      51  33  3      83  53  S     115  73  s
  6614.       20  14  ^T  DC4      52  34  4      84  54  T     116  74  t
  6615.       21  15  ^U  NAK      53  35  5      85  55  U     117  75  u
  6616.       22  16  ^V  SYN      54  36  6      86  56  V     118  76  v
  6617.       23  17  ^W  ETB      55  37  7      87  57  W     119  77  w
  6618.       24  18  ^X  CAN      56  38  8      88  58  X     120  78  x
  6619.       25  19  ^Y  EM       57  39  9      89  59  Y     121  79  y
  6620.       26  1a  ^Z  SUB      58  3a  :      90  5a  Z     122  7a  z
  6621.       27  1b  ^[  ESC      59  3b  ;      91  5b  [     123  7b  {
  6622.       28  1c  ^\  FS       60  3c  <      92  5c  \     124  7c  |
  6623.       29  1d  ^]  GS       61  3d  =      93  5d  ]     125  7d  }
  6624.       30  1e  ^^  RS       62  3e  >      94  5e  ^     126  7e  ~
  6625.       31  1f  ^_  US       63  3f  ?      95  5f  _     127  7f DEL
  6626.      Telix v3.21                                          Appendix B    115
  6627.  
  6628.  
  6629.  
  6630.      7.  APPENDIX B - EXTENDED KEY SCAN CODES
  6631.  
  6632.      The following chart lists keyboard scan codes for special non-ASCII
  6633.      keys, as returned by inkey and inkeyw, and used by the keyget, keyset,
  6634.      keyload, and keysave SALT functions. Normal keys which are within the
  6635.      ASCII set are listed in the preceding appendix.
  6636.  
  6637.  
  6638.      Key      Normal        w / Ctrl        w / Alt       w / Shift
  6639.             Dec     Hex    Dec     Hex    Dec     Hex    Dec     Hex
  6640.      ---------------------------------------------------------------
  6641.      F1     15104  3b00    24064  5e00    26624  6800    21504  5400
  6642.      F2     15360  3c00    24320  5f00    26880  6900    21760  5500
  6643.      F3     15616  3d00    24576  6000    27136  6a00    22016  5600
  6644.      F4     15872  3e00    24832  6100    27392  6b00    22272  5700
  6645.      F5     16128  3f00    25088  6200    27648  6c00    22528  5800
  6646.      F6     16384  4000    25344  6300    27904  6d00    22784  5900
  6647.      F7     16640  4100    25600  6400    28160  6e00    23040  5a00
  6648.      F8     16896  4200    25856  6500    28416  6f00    23296  5b00
  6649.      F9     17152  4300    26112  6600    28672  7000    23552  5c00
  6650.      F10    17408  4400    26368  6700    28928  7100    23808  5d00
  6651.      ---------------------------------------------------------------
  6652.      1                                    30720  7800
  6653.      2                                    30976  7900
  6654.      3                                    31232  7a00
  6655.      4                                    31488  7b00
  6656.      5                                    31744  7c00
  6657.      6                                    32000  7d00
  6658.      7                                    32256  7e00
  6659.      8                                    32512  7f00
  6660.      9                                    32768  8000
  6661.      0                                    33024  8100
  6662.      ---------------------------------------------------------------
  6663.      Up     18432  4800
  6664.      Down   20480  5000
  6665.      Left   19200  4b00    29440  7300
  6666.      Right  19712  4d00    29696  7400
  6667.      Home   18176  4700    30464  7700
  6668.      End    20224  4f00    29952  7500
  6669.      PgUp   18688  4900    33792  8400
  6670.      PgDn   20736  5100    30208  7600
  6671.      Ins    20992  5200
  6672.      Del    21248  5300
  6673.      ---------------------------------------------------------------
  6674.      Telix v3.21                                          Appendix C    116
  6675.  
  6676.  
  6677.  
  6678.      8.  APPENDIX C - COLOR VALUES
  6679.  
  6680.      Several SALT functions, such as pstra, use color attribute values. A
  6681.      character on the text screen has a foreground color, and a background
  6682.      color. Possible colors are numbered as follows:
  6683.  
  6684.                          Black          00
  6685.                          Blue           01
  6686.                          Green          02
  6687.                          Cyan           03
  6688.                          Red            04
  6689.                          Magenta        05
  6690.                          Brown          06
  6691.                          Light Grey     07
  6692.                          Dark Grey      08
  6693.                          Light Blue     09
  6694.                          Light Green    10
  6695.                          Light Cyan     11
  6696.                          Light Red      12
  6697.                          Light Magenta  13
  6698.                          Yellow         14
  6699.                          White          15
  6700.  
  6701.      To obtain a color attribute value for a color combination, the formula
  6702.      is
  6703.  
  6704.           color attribute value =
  6705.  
  6706.                 foreground color value + (16 * background color value)
  6707.  
  6708.      Therefore, a Yellow character on a Blue background would have a color
  6709.      attribute value of 30 (14 + (16 * 1)).
  6710.  
  6711.      Telix v3.21 - SALT Programming                            Index    117
  6712.  
  6713.  
  6714.                                           _time_format.................111
  6715.                                           _up_dir......................111
  6716.      9.  INDEX                            _usage_fname.................112
  6717.                                           _zmod_auto...................112
  6718.      _add_lf.......................98     _zmod_rcrash.................112
  6719.      _alarm_on.....................98     _zmod_scrash.................113
  6720.      _answerback_str...............98     Alarm.........................22
  6721.      _asc_rcrtrans.................98     Box...........................22
  6722.      _asc_remabort.................99     Call..........................23
  6723.      _asc_rlftrans.................99     Calld.........................23
  6724.      _asc_scpacing.................99     Capture.......................24
  6725.      _asc_scrtrans.................99     Capture_stat..................25
  6726.      _asc_secho....................99     Carrier.......................25
  6727.      _asc_sexpand..................99     Cgetc.........................26
  6728.      _asc_slftrans.................99     Cgetct........................26
  6729.      _asc_slpacing.................99     Chatmode......................27
  6730.      _asc_spacechr.................99     Cinp_cnt......................27
  6731.      _asc_striph...................99     Clear_scr.....................28
  6732.      _auto_ans_str................100     Copychrs......................28
  6733.      _back_color..................100     Copystr.......................29
  6734.      _capture_fname...............100     Cputc.........................29
  6735.      _cisb_auto...................101     Cputs.........................30
  6736.      _connect_str.................101     Cputs_tr......................30
  6737.      _date_format.................101     Cursor_onoff..................31
  6738.      _dest_bs.....................102     Curtime.......................31
  6739.      _dial_pause..................102     Date..........................32
  6740.      _dial_time...................102     Delay.........................32
  6741.      _dialpost....................103     Delay_scr.....................32
  6742.      _dialpref....................103     Delchrs.......................33
  6743.      _dialpref2...................103     Dial..........................33
  6744.      _dialpref3...................103     Dos...........................34
  6745.      _dir_prog....................104     Dosfunction...................35
  6746.      _disp_free...................104     Exittelix.....................35
  6747.      _down_dir....................104     Fclearerr.....................36
  6748.      _editor......................104     Fclose........................36
  6749.      _entry_enum..................105     Fdelete.......................37
  6750.      _entry_name..................105     Feof..........................37
  6751.      _entry_num...................105     Ferror........................38
  6752.      _entry_pass..................105     Fflush........................39
  6753.      _ext_filespec................106     Fgetc.........................39
  6754.      _fore_color..................106     Fgets.........................40
  6755.      _image_file..................106     Fileattr......................40
  6756.      _local_echo..................107     Filefind......................42
  6757.      _mdm_hang_str................107     Filesize......................43
  6758.      _mdm_init_str................107     Filetime......................43
  6759.      _no_connect1.................108     Flushbuf......................45
  6760.      _no_connect2.................108     Fnstrip.......................45
  6761.      _no_connect3.................108     Fopen.........................46
  6762.      _no_connect4.................108     Fputc.........................47
  6763.      _qdbar_on....................108     Fputs.........................47
  6764.      _redial_stop.................108     Fread.........................48
  6765.      _scr_chk_key.................109     Frename.......................48
  6766.      _script_dir..................109     Fseek.........................49
  6767.      _sound_on....................109     Ftell.........................50
  6768.      _strip_high..................110     Fwrite........................50
  6769.      _swap_bs.....................110     Get_baud......................51
  6770.      _telix_dir...................110     Get_datab.....................51
  6771.  
  6772.      Telix v3.21 - SALT Programming                            Index    118
  6773.  
  6774.  
  6775.      Get_parity....................52     Strmaxlen.....................78
  6776.      Get_port......................52     Strpos........................78
  6777.      Get_stopb.....................53     Strposi.......................78
  6778.      Getenv........................51     Strupper......................79
  6779.      Gets..........................53     Subchr........................79
  6780.      Getsxy........................54     Subchrs.......................80
  6781.      Getx, gety....................55     Substr........................80
  6782.      Gotoxy........................55     Tday..........................81
  6783.      Hangup........................56     Terminal......................82
  6784.      Helpscreen....................56     Thour.........................81
  6785.      Inkey.........................56     Time..........................83
  6786.      Inkeyw........................56     Time_up.......................84
  6787.      Inschrs.......................57     Timer_free....................84
  6788.      Is_loaded.....................58     Timer_restart.................84
  6789.      Isalnum.......................58     Timer_start...................84
  6790.      Isalpha.......................58     Timer_total...................84
  6791.      Isascii.......................58     Tmin..........................81
  6792.      Iscntrl.......................58     Tmonth........................81
  6793.      Isdigit.......................58     Tolower.......................85
  6794.      Islower.......................58     Tone..........................85
  6795.      Isupper.......................58     Toupper.......................86
  6796.      Itos..........................59     Track.........................86
  6797.      Keyget........................59     Track_addchr..................86
  6798.      Keyload.......................60     Track_free....................86
  6799.      Keysave.......................61     Track_hit.....................86
  6800.      Keyset........................61     Transtab......................88
  6801.      Load_scr......................62     Tsec..........................81
  6802.      Loadfon.......................62     Tyear.........................81
  6803.      Newdir........................63     Unload_scr....................89
  6804.      Printc........................63     Update_term...................89
  6805.      Printer.......................64     Usage_stat....................90
  6806.      Printn........................64     Usagelog......................90
  6807.      Prints........................65     Ustamp........................91
  6808.      Printsc.......................65     Vgetchr.......................92
  6809.      Printsc_trm...................65     Vgetchrs......................92
  6810.      Pstra.........................65     Vgetchrsa.....................92
  6811.      Pstraxy.......................65     Vputchr.......................93
  6812.      Receive.......................66     Vputchrs......................94
  6813.      Redial........................67     Vputchrsa.....................94
  6814.      Run...........................68     Vrstrarea.....................95
  6815.      Scroll........................69     Vsavearea.....................95
  6816.      Send..........................69     Waitfor.......................96
  6817.      Send_brk......................70
  6818.      Set_cparams...................70
  6819.      Set_defprot...................71
  6820.      Set_port......................73
  6821.      Set_terminal..................73
  6822.      Setchr........................72
  6823.      Setchrs.......................72
  6824.      Show_directory................74
  6825.      Status_wind...................74
  6826.      Stoi..........................75
  6827.      Strcat........................75
  6828.      Strchr........................76
  6829.      Strcmpi.......................76
  6830.      Strlen........................77
  6831.      Strlower......................77
  6832.